header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

shutdown remote pc
Last Post 11 Aug 2008 07:31 AM by Shay. 6 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
AshtonnewUser is Offline
New Member
New Member
Posts:4
Avatar

--
11 Aug 2008 02:35 AM  

Please if someone could help me , I am knew to pweer shell. i how could i write a cript to shutdown a remote pc

glnsizeUser is Offline
Basic Member
Basic Member
Posts:101

--
11 Aug 2008 02:46 AM  

errrr... while it's not a PowerShell thing.  You can shutdown any remote pc with shutdown.exe...

shutdown.exe /s /m \\targetpc /f
will shutdown targetpc forcefully, meaning close any apps open, and terminate any hung processes.

or if you prefer...
Shutdown.exe /I
will launch a gui. :)

What exactly are you trying to do?
~Glenn

 

halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:334
Avatar

--
11 Aug 2008 02:56 AM  
Oh come on, Glenn!

Ashton, try this article. It's pretty simple.
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
AshtonnewUser is Offline
New Member
New Member
Posts:4
Avatar

--
11 Aug 2008 02:58 AM  

I know about shutdown,exe . I  already have a vbscript to do the shutdown, I just  wanted to know if there was a way with powershell I can do it.

AshtonnewUser is Offline
New Member
New Member
Posts:4
Avatar

--
11 Aug 2008 03:04 AM  

Thanks a lot , I will try it

glnsizeUser is Offline
Basic Member
Basic Member
Posts:101

--
11 Aug 2008 03:53 AM  

give me a break... it's an .exe... does everything have to be either wmi or .net.

gc computers.txt | % {Invoke-Command {shutdown /t /m $_ /f }}

 let's not forget the BEST thing about posh.  Everything we ever learned is still applicable.

Having said that wmi is way better ;)

~Glenn

ShayUser is Offline
Basic Member
Basic Member
Posts:271
Avatar

--
11 Aug 2008 07:31 AM  

Try the Shutdown() method:

PS > (gwmi win32_operatingsystem  -computer computerName).Shutdown()

Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer