This works from SERVERB directly.
Invoke-Command -ComputerName ServerB -ScriptBlock { Get-Process}

I tried it using with the credential argument and it also works
Invoke-Command -ComputerName ServerB -ScriptBlock { Get-Process} -Credential 
$credential

But with the DLS script it does not.


Thanks,
Jason

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Trevor Sullivan
Sent: Thursday, January 16, 2014 10:50 AM
To: scripting@lists.myitforum.com
Subject: RE: [scripting] Invoke-Command

Jason,

Can you send a screenshot of the issue? Your font is rather challenging to read.

Have you tried a simpler command, just for starters? When all else fails, take 
it back to the basics.

Invoke-Command -ComputerName serverb -ScriptBlock { Get-Process; };

Cheers,
Trevor Sullivan

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of 
jlos...@mpi.mb.ca<mailto:jlos...@mpi.mb.ca>
Sent: Thursday, January 16, 2014 10:25 AM
To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>
Subject: RE: [scripting] Invoke-Command

Here is the error we receive

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
An error occured trying to connect to  SERVERB
DEBUG: Attempting to execute the following command:
Invoke-Command -ComputerName  SERVERB -ScriptBlock {param() & 'D:\DLS Security 
Manag
ement Scripts\display_mf_user.ps1' -userID } -ArgumentList @( user) -Credenti
al System.Management.Automation.PSCredential -SessionOption System.Management.Au
tomation.Remoting.PSSessionOption -ErrorAction Stop




Thanks,
Jason

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of Trevor Sullivan
Sent: Thursday, January 16, 2014 10:17 AM
To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>
Subject: RE: [scripting] Invoke-Command

Jason,

What do you mean "does not work?" Are you getting an error? If so, what is the 
error?

FYI, you have to enable Windows Remote Management (WinRM) to use 
Invoke-Command. Use Enable-PSRemoting -Force or Set-WsmanQuickConfig, or use 
Active Directory Group Policy to enable WinRM.

Cheers,
Trevor Sullivan

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of 
jlos...@mpi.mb.ca<mailto:jlos...@mpi.mb.ca>
Sent: Thursday, January 16, 2014 10:03 AM
To: scripting@lists.myITforum.com<mailto:scripting@lists.myITforum.com>
Subject: [scripting] Invoke-Command

Hi, we have a set of scripts that run on ServerA and they do not run on 
identical  ServerB
The Invoke-Command does not work locally or remotely on ServerB

Any ideas?

Thanks,

Jason Loster
Senior IT Analyst
IT Security, Compliance and Risk Management
Manitoba Public Insurance
708-234 Donald St.
Winnipeg, MB, R3C 4A4
jlos...@mpi.mb.ca<mailto:jlos...@mpi.mb.ca>










Reply via email to