Solved

Enabling and configuring WinRM service on remote machine

Posted on 2014-02-21
4
267 Views
Last Modified: 2014-02-26
Hello,

I want to be able to manage my machines remotely using powershell. I know that in order to do this, I will need the WinRM service running and configured on these machines.

How can I accomplish this without having to remote into every machine to configure it?

Thanks.
0
Comment
Question by:LuiLui77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 39878192
Create a scheduled task on each server:

This is assuming you have Admin permissions on each server.

$servers = (gc $serverList.txt)
$file = c:\localfile.bat
foreach ($COMPUTER in $servers)
{
copy $file \\$Computer\c$\temp\
psexec -u user -p password \\$computer cmd /c schtasks /create /tn enableWS2 /RL Highest /tr c:\temp\enable-ws.bat /sc once  /ST $starttime /ru $Username /rp $usrpwd /F
}

Open in new window


You bat or cmd file only needs to be

Enable-PSRemoting -Force


You may want to restart the computers once you know the task has been run.

You can verify with:
test-wsman -computername $computer

 
Once you verify it is working you can run this to remove the task:
psexec -u user -p password  \\$computer cmd /c schtasks /delete /tn enablePS /F
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 39878272
powershell Enable-PSRemoting -Force

Open in new window


otherwise it will fail with unknown command
0
 
LVL 29

Expert Comment

by:becraig
ID: 39878279
Thanks David I forgot to add powershell in front for the batch file.
0
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39878410
If you're in a domain, use Group Policy.  All the settings are in this link.
http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/24/an-introduction-to-powershell-remoting-part-two-configuring-powershell-remoting.aspx

You're just setting the service to run automatically, configuring the listeners, and enabling the firewall rule (as seen in the first three images).
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question