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.
Error
At C:\Octopus\Work\20181112141732-7678-7\Script.ps1:3 char:68
Error

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

Error
+ 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.