cancel
Showing results for 
Search instead for 
Did you mean: 

VSR Scripting - How to get Image Job Network User

Josonic
Level 2

Hi, I have successfully used the example powershell scripts that come with VSR 18 to script creating backup jobs, that back up to a network drive.

I am now trying to write a script to get each ImageJobs NetworkUser and then change the NetworkPassword.

I have spent a day trying to find how to get an ImageJobs NetworkUser but have failed.

Please will someone help me out. See below for the script I am trying to get to work.

Many Thanks, Josonic

 

# I have got the system volume as $oVolume, and therefore its ID

ForEach($ImageJob in $v2iAuto.ImageJobs)
{
   Write-Host $ImageJob.Displayname

   # shows displayname correctly

   Write-Host $ImageJob.Location

   # shows 'IImageLocation Location (string) {get} {set}' 

   Write-Host $ImageJob.Location($oVolume.ID)

   # shows 'The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))'

   Write-Host $ImageJob.Location($oVolume.ID).Path

   # shows 'The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))'

}

1 ACCEPTED SOLUTION

Accepted Solutions

Josonic
Level 2

SOLVED: In answer to my own question, the (powershell) solution is:-

$v2iAuto = New-Object -ComObject "Veritas.ProtectorAuto"

$v2iAuto.Connect($env:COMPUTERNAME)

ForEach($ImageJob in $v2iAuto.ImageJobs)
{

   Write-Host $ImageJob.Location($ImageJob.Volumes[0]).NetworkUser

}

View solution in original post

1 REPLY 1

Josonic
Level 2

SOLVED: In answer to my own question, the (powershell) solution is:-

$v2iAuto = New-Object -ComObject "Veritas.ProtectorAuto"

$v2iAuto.Connect($env:COMPUTERNAME)

ForEach($ImageJob in $v2iAuto.ImageJobs)
{

   Write-Host $ImageJob.Location($ImageJob.Volumes[0]).NetworkUser

}