PowerShell script exchange
Post Reply
veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

gotxi wrote:I cancelled at this point, every VM fails the same.
You should change this line:

Code: Select all

$ZIPSession = Start-VBRZip -Entity $VMName ...
To

Code: Select all

$ZIPSession = Start-VBRZip -Entity $VM ...
You're trying to pass a string object, while Entity parameter excepts IItem one. Thus, the issue.

Thanks.

gotxi
Novice
Posts: 5
Liked: never
Joined: Oct 07, 2015 7:30 am
Full Name: David Gacias

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by gotxi »

Thanks a lot for the fast response. I was dumb, i modified the encrypted case and my backups are non-encrypted so... my fault.

Now powershell does not throw errors, but the final mail im receiving says i don't have permissions:

Code: Select all

Processing finished with errors at 07/10/2015 11:15:55 Task failed. Failed to expand object 2012R2HATHOR. Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
What more do i need to do? My Hyper-V credentials works fine in the GUI.

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Hmm, did a VeeamZIP finish successfully or not? What error is reported in GUI? Are you able to initiate a VeeamZIP task against a given VM in GUI? Will not that result in a similar issue, if you let it run for some time?

gotxi
Novice
Posts: 5
Liked: never
Joined: Oct 07, 2015 7:30 am
Full Name: David Gacias

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by gotxi »

You are right, now it gives me the same error on the GUI:

Code: Select all

Backup job: 2012R2HATHOR_2015-10-07T141815 (Full)
Error
1 of 1 VMs processed
miércoles, 7 de octubre de 2015 14:18:15
Success 0 Start time 14:18:15 Total size 0,0 KB Backup size 0,0 KB  
Warning 0 End time 14:18:21 Data read 0,0 KB Dedupe 1,0x
Error 1 Duration 0:00:06 Transferred 0,0 KB Compression 1,0x
Details
Name Status Start time End time Size Read Transferred Duration Details
2012R2HATHOR Error 14:18:21 14:18:21 0,0 KB 0,0 KB 0,0 KB 0:00:00 Task failed. Failed to expand object 2012R2HATHOR. Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

gotxi
Novice
Posts: 5
Liked: never
Joined: Oct 07, 2015 7:30 am
Full Name: David Gacias

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by gotxi »

I deleted and readded my credentials and now the GUI works again, but when launched via powershell, now throws me this:

Code: Select all

Backup job: 2012R2HATHOR_2015-10-07T154726 (Full)
Error
1 of 1 VMs processed
miércoles, 7 de octubre de 2015 15:47:26
Success 0 Start time 15:47:26 Total size 0,0 KB Backup size 0,0 KB Error: The system cannot find the path specified. Failed to create or open file [Z:\Backup_2012R2HATHOR_2015-10-07T154726.vbk].
Warning 0 End time 15:51:16 Data read 0,0 KB Dedupe 1,0x
Error 1 Duration 0:03:50 Transferred 0,0 KB Compression 1,0x
Details
Name Status Start time End time Size Read Transferred Duration Details
2012R2HATHOR Error 15:51:04 15:51:16 0,0 KB 0,0 KB 0,0 KB 0:00:11 Job has failed. See logs for details.
 

Laszlo
Lurker
Posts: 1
Liked: never
Joined: Oct 07, 2015 3:25 pm
Full Name: Laszlo Puteani
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by Laszlo »

After update 2 I get this error regarding registry access, I think it is fairly simple to fix but I do not know which keys are affected:

Code: Select all

Get-VBRServer : Aangevraagde registertoegang is niet toegestaan.
At C:\Users\Veeam\Desktop\Emeubel.ps1:71 char:11
+ $Server = Get-VBRServer -name $HostName
+           ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException
 
Find-VBRViEntity : Aangevraagde registertoegang is niet toegestaan.
At C:\Users\Veeam\Desktop\Emeubel.ps1:76 char:9
+   $VM = Find-VBRViEntity -Name $VMName -Server $Server
+         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException
 
Start-VBRZip : Aangevraagde registertoegang is niet toegestaan.
At C:\Users\Veeam\Desktop\Emeubel.ps1:86 char:19
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+                   ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException
Could anyone comment on this please? Already updated to powershell ISE

gotxi
Novice
Posts: 5
Liked: never
Joined: Oct 07, 2015 7:30 am
Full Name: David Gacias

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by gotxi »

gotxi wrote:I deleted and readded my credentials and now the GUI works again, but when launched via powershell, now throws me this:

Code: Select all

The system cannot find the path specified. Failed to create or open file [Z:\Backup_2012R2HATHOR_2015-10-07T154726.vbk 
Nevermind, i followed this post and changed my mapped drive to the full path and now it works. Thanks anyway! :)

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Laszlo wrote:After update 2 I get this error regarding registry access, I think it is fairly simple to fix but I do not know which keys are affected:
I think the cause is account lacking required permissions, try to either run a script as an administrator or create self-elevating script. Thanks.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

I tried using the following script

Code: Select all

##################################################################
#                   User Defined Variables
##################################################################

# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = "CGw--26909-(TestResellerGSARTZcopy)"

# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "vmware"

# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = "c:\backup"

# Desired compression level (Optional; Possible values: 0 - None, 4 - Dedupe-friendly, 5 - Optimal, 6 - High, 9 - Extreme) 
$CompressionLevel = "5"

# Quiesce VM when taking snapshot (Optional; VMware Tools are required; Possible values: $True/$False)
$EnableQuiescence = $True

# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $True

# Encryption Key (Optional; path to a secure string)
$EncryptionKey = ""

# Retention settings (Optional; By default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time. 
# Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = "TomorrowNight"

##################################################################
#                   Notification Settings
##################################################################

# Enable notification (Optional)
$EnableNotification = $True

# Email SMTP server
$SMTPServer = ""

# Email FROM
$EmailFrom = "" 

# Email TO
$EmailTo = ""

# Email subject
$EmailSubject = ""

##################################################################
#                   Email formatting 
##################################################################

$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"

##################################################################
#                   End User Defined Variables
##################################################################

#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin

$Server = Get-VBRServer -name $HostName
$MesssagyBody = @()

foreach ($VMName in $VMNames)
{
  $VM = Find-VBRViEntity -Name $VMName -Server $Server
  
  If ($EnableEncryption)
  {
    $EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | ConvertTo-SecureString)
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention -EncryptionKey $EncryptionKey
  }
  
  Else 
  {
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
  }
  
  If ($EnableNotification) 
  {
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"}
  
  if ($FailedSessions -ne $Null)
  {
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={$FailedSessions.Title}})
  }
   
  Else
  {
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
  }
  
  }   
}
If ($EnableNotification)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}

But I keep getting this error

Code: Select all

Find-VBRViEntity : Cannot validate argument on parameter 'Server'. The argument is null. Provide a valid value for the argument, and then 
try running the command again.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:76 char:48
+   $VM = Find-VBRViEntity -Name $VMName -Server $Server
+                                                ~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Find-VBRViEntity], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Command.FindVBRViEntity
 
Get-Content : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:80 char:58
+     $EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | Conver ...
+                                                          ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Content], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetContentCommand
 
Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value for the argument, and then try 
running the command again.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:81 char:40
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+                                        ~~~
    + CategoryInfo          : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
 
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:91 char:5
+     $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
New-Object : Exception calling ".ctor" with "2" argument(s): "The parameter 'from' cannot be an empty string.
Parameter name: from"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:108 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
 
The property 'Subject' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:109 char:1
+ $Message.Subject = $EmailSubject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'IsBodyHTML' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:110 char:1
+ $Message.IsBodyHTML = $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'Body' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:111 char:1
+ $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
Exception calling "Send" with "1" argument(s): "Value cannot be null.
Parameter name: message"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException
Any ideas?

I am using a vpshere with 2 vmware nodes running in cluster and the server $HostName = "vmware" is the vsphere server

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Under which name the given host is added to a backup server? What happens if you run just these lines:

Code: Select all

$HostName = "vmware"
Get-VBRServer -name $HostName
Will the code return the said server?

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

I am not sure what exactly you mean. I have added "vmware" in hosts file in order to point to the vsphere server IP. When I run the two commands that you wrote in PS I dont get any errors but I dont get any reply too

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

I meant you have to add it to the backup console in order to be able to backup VMs residing on it. Is that the case?

Image

Thanks.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

You are right, I made a typo there and that created the problem. I get a new error now:

Code: Select all

Start-VBRZip : License is not installed.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:86 char:19
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-VBRZip], CLicenseNotInstalledException
    + FullyQualifiedErrorId : Veeam.Backup.LicenseLib.CLicenseNotInstalledException,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
 
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:91 char:5
+     $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
New-Object : Exception calling ".ctor" with "2" argument(s): "The parameter 'from' cannot be an empty string.
Parameter name: from"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:108 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
 
The property 'Subject' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:109 char:1
+ $Message.Subject = $EmailSubject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'IsBodyHTML' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:110 char:1
+ $Message.IsBodyHTML = $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'Body' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:111 char:1
+ $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
Exception calling "Send" with "1" argument(s): "Value cannot be null.
Parameter name: message"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Are you positive that Update 2 is installed and that you've followed the appropriate order?

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

v.Eremin wrote:Are you positive that Update 2 is installed and that you've followed the appropriate order?
I reinstalled it just in case and now I skipped the previous error, but I have a new one.

Code: Select all

New-Object : Exception calling ".ctor" with "2" argument(s): "The parameter 'from' cannot be an empty string.
Parameter name: from"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:108 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
 
The property 'Subject' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:109 char:1
+ $Message.Subject = $EmailSubject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'IsBodyHTML' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:110 char:1
+ $Message.IsBodyHTML = $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'Body' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:111 char:1
+ $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
Exception calling "Send" with "1" argument(s): "Value cannot be null.
Parameter name: message"
At C:\Users\Administrator\Desktop\VeeamZIP (updated).ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException
Vladimitr thank you for your time :)

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Since you've enabled email notification, you have to fill all the variables present in the corresponding section (Notification settings), namely:

Code: Select all

# Email SMTP server
$SMTPServer = ""

# Email FROM
$EmailFrom = ""

# Email TO
$EmailTo = ""

# Email subject
$EmailSubject = ""
Thanks.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis » 1 person likes this post

it works fine now, thank you.

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

You're welcome. Should other inquiry regarding scripting arise, don't hesitate to let me know.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

well it did :) I created the scheduled task based on your instructions and I am receiving a Last run result

Code: Select all

"the task is currently running (0x413101). On the event viewer I am getting the following errors
DistributedCOM
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{228826AF-02E1-4226-A9E0-99A855E455A6}
 and APPID 
{2FD08A73-D1F1-43EB-B888-24C2496F95FD}
 to the user OPSVDI03\Administrator SID (S-1-5-21-3488395209-2549419410-3413837551-500) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
On the veeam history I dont see any actions

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

What happens if you run this script manually, using administrator account?

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

v.Eremin wrote:What happens if you run this script manually, using administrator account?
it works fine

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Then, it seems that account used to run scheduled task lacks required permissions. Also, it might be worth checking under which account VB&R service is executed. Thanks.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

v.Eremin wrote:Then, it seems that account used to run scheduled task lacks required permissions. Also, it might be worth checking under which account VB&R service is executed. Thanks.
I am running the task using the same user I am running the ps1 script. I changed all service accounts of VB&R to the same user, but no luck...

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

You mean if you execute the very same task manually, using the said account, everything will be ok, but when you run via Task Scheduler, it doesn't seem to work, right? If so, can you enable "Run with the highest privileges" option in the Task properties and see whether it helps or not? Thanks.

Badger101
Novice
Posts: 3
Liked: 1 time
Joined: Oct 18, 2015 5:58 pm
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by Badger101 »

I am looking on how to import the Start-VBRzip into powershell. Powershell doesn't reconize the get-VBRServer command or any for that matter. I didn't the commandlet in the program files folder either.

Badger101
Novice
Posts: 3
Liked: 1 time
Joined: Oct 18, 2015 5:58 pm
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by Badger101 »

I have grabbed the script, but it seems powershell isn't aware of the get-VBRzip command. Where do I get that to import it into powershell? I am currently running powershell 4.0.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

v.Eremin wrote:You mean if you execute the very same task manually, using the said account, everything will be ok, but when you run via Task Scheduler, it doesn't seem to work, right? If so, can you enable "Run with the highest privileges" option in the Task properties and see whether it helps or not? Thanks.
the problems is the exact one that you describe, I have tried running with highest privileges but it wont work. I have tried changing the script to "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe –file “c:\veaam.ps1”" it wont work either.

On event viewer I am getting

Code: Select all

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{228826AF-02E1-4226-A9E0-99A855E455A6}
 and APPID 
{2FD08A73-D1F1-43EB-B888-24C2496F95FD}
 to the user OPSVDI03\Administrator SID (S-1-5-21-3488395209-2549419410-3413837551-500) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
I found the speficic APPID which is the Immersive Shell Broker and it does not allow me to change security settings. I am working on that now

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

I have grabbed the script, but it seems powershell isn't aware of the get-VBRzip command. Where do I get that to import it into powershell? I am currently running powershell 4.0.
During product installation make sure to install VB&R PS snap-in. Afterwards, you should add it to current PS session, using Add-PSSnapin:

Code: Select all

Asnp VeeamPSSnapin
Don't forget to install update 2 to let Start-VBRZIP command work with free product edition.

Thanks.

johnfistikis
Influencer
Posts: 11
Liked: 1 time
Joined: Oct 13, 2015 8:09 am
Full Name: John fistikis
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by johnfistikis »

I already did, thats why it works when I manually run the script

veremin
Product Manager
Posts: 18002
Liked: 1713 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Discussion on blog post: Update 2 featuring PowerShell

Post by veremin »

Actually, John, I quoted @Badger101 and tried to provide a solution for his problem.

As to your issue, I still believe that it is solely related to absence of required permissions, and might be addressed by granting those via adjusting DCOM config.

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests