Link to home
Start Free TrialLog in
Avatar of Isaiah Melendez
Isaiah Melendez

asked on

Powershell 2.0/3.0

Hi Experts,

I need help building a quick script that will engage a remote computers services to start and stop them.

I need it to work on both v 2.0 and 3.0.

EX:

RemotePCName =  DB1
ServiceName = FunGuy


Environments W7,8,10
Avatar of K B
K B
Flag of United States of America image

$cred      = (Get-Credential)


Invoke-Command {start-service FunGuy –passthru} -Credential $cred –comp DB1,DB2

Open in new window



Enabling Remoting

Before a computer will accept remote PowerShell connections, the following list of items must be in place:

The WinRM service must be running.
There must be a WinRM listener that accepts connections from one or more IP addresses.
The Windows firewall must be configured to allow the WinRM connection.
There must be an enabled and properly configured PowerShell session.

source: http://windowsitpro.com/scripting/windows-powershell-20-remoting
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial