Remotely enable PSRemoting

Hi guys,

So, the scripting world is new to me but I’m trying to get a handle on it, and hope that you can help me.

I’m working in a mixed environment; our domain contains XP clients and 2008R2 servers. All client computers have PS 2.0 installed.

I want to be able to work with PSRemoting on other client computers. Of course I have Admin privileges and I ran the commands as admin.

My problem is that I can't enable remoting through Group Policy. Our organization is really big and changing GPO will take forever because of IT policies and different approvals.

Right now we have a few jobs we really need to execute and can’t wait till GPO changes are done.

So actually, I’m looking for a way to enable remoting on remote machines in our domain. When I logon interactively to a machine and enable PSReomting, I’m able to work remotly on this machine after that. But I can't find a way to remotely enable PSReomting.

I’ve tried to enable the winrm service through cmd, and then with PS, like this:

SC \\server start winrm

Then, from PS:

foreach ($i in 'Computer') { Enable-PSRemoting -Force }

Then I ran winrm quickconfig, and the result was:

WinRM already is set up to receive requests on this machine

WinRM already is set up for remote management on this machine

After performing these steps, I tried remoting and got this error:

"Connecting to remote server failed with the following error message: access is denied. for more info...."

I went through every step in About_Remote_Troubleshooting but found nothing.

After googling for hours I found nothing.

Also, does anyone know if PS Active Directory module is available for XP? After some searching it looks like XP doesn’t support this module, but just to make sure.

Thank you J

November 25th, 2011 8:34am

for security reasons you cant run the commands remotely.   you'd need to login and then run it.   you could maybe do something like telnet to configure it perhaps? but im guessing it will still see and catch that.   maybe remotely deploy a schedule task that runs the commands? that might work and shouldnt be too hard.   I've tried this and it seems to catch a lot of methods of remote config, I gave in quickly and went to GPO since its not too bad to get that deployed for me.   schedule task is probably worth a try tho    
Free Windows Admin Tool Kit Click here and download it now
November 25th, 2011 1:45pm

AD module on XP

Not supported on XP, but once you have PowerShell remoting, you can remote into your DC and use proxy functions so you have access to the cmdlets.

November 25th, 2011 11:39pm

This might help:

http://www.davidaiken.com/2011/01/12/enable-powershell-remoting-on-windows-azure/

Free Windows Admin Tool Kit Click here and download it now
November 25th, 2011 11:42pm

Hi guys,

Thanks for the replay, great idea. i took your advice and created a task using the schtasks command.

I placed a batch file in a network share, which runs a ps1 file with enable-psremoting -force command.

Using the schtasks, i scheduled a task to run the script and everything went great.

Work like a charm!


November 27th, 2011 9:37pm

Hi guys,

Thanks for the replay, great idea. i took your advice and created a task using the schtasks command.

I placed a batch file in a network share, which runs a ps1 file with enable-psremoting -force command.

Using the schtasks, i scheduled a task to run the script and everything went great.

Work like a charm!


Free Windows Admin Tool Kit Click here and download it now
November 27th, 2011 9:37pm

Hi, I know this has been answered, but I feel using schtasks is overly complicated. I've found a better way and am posting it since this question is the top result in Google for the topic.

First, you need to have a microsoft tool - psexec - http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx - download and extract to where ever.

After that run cmd.exe, and navigate to whatever folder psexec has been extracted to (ie. cd C:\[path to psexec's containing folder)

Then run this command:

psexec \\[computer name] -u [admin account name] -p [admin account password] -h -d powershell.exe "enable-psremoting -force"

That's it. Twiddle your thumbs for a couple minutes - enable-psremoting can sometimes take a while and the -d modifier just lets it happen in the background on the target remote machine, then you are good to go with all your psRemoting funtimes.

You can also replace "\\[computer name]" with an ip address, or even "@C:\[path]\list.txt to automatically enable psRemoting on a big list of computers on your network. Very fast, very easy.

Hope this is clear enough for the less experienced because most of what turns up on Google is not very helpful for this topic.

  • Proposed as answer by whatyousay Monday, July 23, 2012 9:23 PM
July 23rd, 2012 9:23pm

Hi, I know this has been answered, but I feel using schtasks is overly complicated. I've found a better way and am posting it since this question is the top result in Google for the topic.

First, you need to have a microsoft tool - psexec - http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx - download and extract to where ever.

After that run cmd.exe, and navigate to whatever folder psexec has been extracted to (ie. cd C:\[path to psexec's containing folder)

Then run this command:

psexec \\[computer name] -u [admin account name] -p [admin account password] -h -d powershell.exe "enable-psremoting -force"

That's it. Twiddle your thumbs for a couple minutes - enable-psremoting can sometimes take a while and the -d modifier just lets it happen in the background on the target remote machine, then you are good to go with all your psRemoting funtimes.

You can also replace "\\[computer name]" with an ip address, or even "@C:\[path]\list.txt to automatically enable psRemoting on a big list of computers on your network. Very fast, very easy.

Hope this is clear enough for the less experienced because most of what turns up on Google is not very helpful for this topic.

  • Proposed as answer by whatyousay Monday, July 23, 2012 9:23 PM
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2012 9:23pm

Great Article! Helped me save a lot of time by enabling the PSremoting remotely by using the Psexec tools as you suggested. Thanks!

July 30th, 2013 4:27pm

Great Article! Helped me save a lot of time by enabling the PSremoting remotely by using the Psexec tools as you suggested. Thanks!

Free Windows Admin Tool Kit Click here and download it now
July 30th, 2013 4:27pm

There's also a nice set of PowerShell functions in the gallery:

http://gallery.technet.microsoft.com/scriptcenter/Enable-PSRemoting-Remotely-6cedfcb0


  • Edited by -Nick Tuesday, July 30, 2013 5:11 PM
  • Proposed as answer by Mike Laughlin Tuesday, July 30, 2013 6:07 PM
July 30th, 2013 5:07pm

There's also a nice set of PowerShell functions in the gallery:

http://gallery.technet.microsoft.com/scriptcenter/Enable-PSRemoting-Remotely-6cedfcb0


  • Edited by -Nick Tuesday, July 30, 2013 5:11 PM
  • Proposed as answer by Mike Laughlin Tuesday, July 30, 2013 6:07 PM
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2013 5:07pm

Very helpful, thanks!
January 24th, 2014 11:59am

Hi,

How would you use the functions since I am new to ps. Can you please give some example ie running against one computer and also running with multiple computers.

Thanks,

Free Windows Admin Tool Kit Click here and download it now
October 31st, 2014 11:34am

Thanks whatyousay!  It worked for me!
February 26th, 2015 5:26pm

Great @whatyousay, I spent a good chunk of my day, and your use of the flag -d was what did the trick!!

It was the missing piece of the puzzle with psexec.

Do you know why when non interactive works and otherwise not?

Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2015 5:02pm

You sir, are my hero today!!  Just saved me from 96 separate RDP sessions.

June 17th, 2015 3:42pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics