Remote PowerShell credentials error

Started by Michael

Michael

Remote PowerShell credentials error   23 February 2016, 00:41

Trying to use this to do a network scan and find out if a current virus file we've been suffering from is on the relevant computers. But I get an error messages as follows:
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?
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell credentials error   23 February 2016, 09:58

It looks like in some cases PowerShell wants a fully qualified path to PSCredential, i.e. System.Management.Automation.PSCredential.

Try this build and let me know if it works.
Michael

Re: Remote PowerShell credentials error   24 February 2016, 02:52

Yes, that does the trick. Brilliant - thanks for the quick response.

Sometimes you can get the answer faster if you try the forum search and/or have a look at the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **         **        **     **   ******   ********  
 **    **   **        **     **  **    **  **     ** 
 **    **   **        **     **  **        **     ** 
 **    **   **        *********  **        **     ** 
 *********  **        **     **  **        **     ** 
       **   **        **     **  **    **  **     ** 
       **   ********  **     **   ******   ********  

Message: