Error: New-Object : Cannot find type [PSCredential]: make sure the assembly containing this type is loaded., At line:1 char:83, + Invoke-Command -ComputerName 10.123.90.28 -HideComputerName -Credential (New-Object <<<< PSCredential -ArgumentList 'xxxxxxxx\xxxxx', (ConvertTo-SecureString -AsPlainText '**********' -Force)) -ScriptBlock { Test-Path 'C:\User, s\*\AppData\Local\Temp\*.tmp.exe' }, + CategoryInfo: InvalidType: (:) [New-Object], PSArgumentException + FullyQualifiedErrorId : TypeNotFound, Microsoft.PowerShell.Commands.NewObjectCommand
I can connect to a computer in PowerShell ISE okay using the credentials and even run the command I'm trying to run okay...
PS S:\> Enter-PSSession 'MR-WELLINGTON' -Credential:'xxxxxxxx\xxxxx' [mr-wellington]: PS Test-Path 'C:\Users\*\AppData\Local\Temp\*.tmp.exe' False
Any ideas?