Forum Discussion

Josonic's avatar
Josonic
Level 2
5 years ago

VSR Scripting - How to get Image Job Network User

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))'

}

  • 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

    }

  • 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

    }