I am trying to enter a new PSSession. If I manually run each line it works, but when I run it as part of a script, I get an error. The creds are valid and it seems the session is created, I just cant enter it in the script. The line number referenced is the write-host. Even if I just have an assignment to a variable it errors there.
$cred = New-Object Management.Automation.PSCredential ($username, $pw)
New-PSSession -ComputerName App02 -Credential $cred
Get-PSSession | Enter-PSSession
Write-Host "ERROR: Partial Service Deployment. See error log file(s)"
I get this as an error:
Cannot perform operation because operation "NewNotImplementedException at offset 63 in file:line:column :0:0 " is not implemented. At C:\DEV\Sandbox\Sandbox.ps1:29 char:14 + Write-Host "ERROR: Partial Service Deployment. See error log file(s ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [], RuntimeException + FullyQualifiedErrorId : NotImplemented