Error running powershell to restore Hyper-V snapshot

$username = “remotelocalbox\administrator”
#get password from previously created encrypted password file
$password = get-content C:\temp\username-password-encrypted.txt | convertto-securestring
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
#Invoke-Command -Computername HIPPO -ScriptBlock {Restore-VMSnapshot -Name “Tentacle Installed and updated” -VMName “Alps” -Confirm:$false} -credential $cred
Invoke-Command -Computername HIPPO -ScriptBlock {Start-VM -VMName “Alps”} -credential $cred

returns the following error:
convertto-securestring : The system cannot find the path specified.
At C:\Octopus\Work\20181112141732-7678-7\Script.ps1:3 char:68

  • … ent C:\temp\username-password-encrypted.txt | convertto-securestring
  •                                                ~~~~~~~~~~~~~~~~~~~~~~ 

+ CategoryInfo : InvalidArgument: (:slight_smile: [ConvertTo-SecureString], C

—the file exists in temp on octopus server and I am running on the octopus server - this works in ISE

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.