Fossil Rock Posted December 1, 2007 Posted December 1, 2007 Think I did that too with the suggestion checking out "net view" Yes sir Yes sir you did and I apologize for over looking that. Agreement is not necessary - thinking for one's self is!
themax90 Posted December 1, 2007 Posted December 1, 2007 C:\>shutdown /? Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c omment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536) Did you see the question about "Net view" in this pile of post ? Was talking about AutoIt's Shutdown function..........
Chris86 Posted December 1, 2007 Author Posted December 1, 2007 C:\>shutdown /? Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c omment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536) Did you see the question about "Net view" in this pile of post ? I have a friend that told me how to shutdown computers with commandline, and then i got an idea how to control my servers.
Developers Jos Posted December 1, 2007 Developers Posted December 1, 2007 I have a friend that told me how to shutdown computers with commandline, and then i got an idea how to control my servers.I have build several script that ran software upgrades remotely using PSEXEC and PSSHUTDOWN commands supplied by Sysinternals (Microsoft owned these days).Its a real nice way to do a mass upgrade to remote servers. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ptrex Posted December 2, 2007 Posted December 2, 2007 @all This should get you all going (no external tools needed). #Include <Constants.au3> $s_Machine = InputBox("Input", "Please enter the name of the computer you want to reboot") $s_Command = InputBox("Input", "0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot " & _ "|8=Power Off|8+4=Forced Power Off") _RemoteShutdown($s_Machine, $s_Command) Func _RemoteShutdown(ByRef $s_Machine, ByRef $s_Command) Local $wbemFlagReturnImmediately, $wbemFlagForwardOnly, $objWMIService, $colItems, $objItem $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $objWMIService = ObjGet("winmgmts:\\" & $s_Machine & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT Name From Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ; 0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot|8=Power Off|8+4=Forced Power Off For $objItem in $colItems $objItem.Win32ShutDown($s_Command) Next EndFunc; ==> _RemoteShutdown Please keep on smiling regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
themax90 Posted December 2, 2007 Posted December 2, 2007 @all This should get you all going (no external tools needed). #Include <Constants.au3> $s_Machine = InputBox("Input", "Please enter the name of the computer you want to reboot") $s_Command = InputBox("Input", "0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot " & _ "|8=Power Off|8+4=Forced Power Off") _RemoteShutdown($s_Machine, $s_Command) Func _RemoteShutdown(ByRef $s_Machine, ByRef $s_Command) Local $wbemFlagReturnImmediately, $wbemFlagForwardOnly, $objWMIService, $colItems, $objItem $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $objWMIService = ObjGet("winmgmts:\\" & $s_Machine & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT Name From Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ; 0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot|8=Power Off|8+4=Forced Power Off For $objItem in $colItems $objItem.Win32ShutDown($s_Command) Next EndFunc; ==> _RemoteShutdown Please keep on smiling regards ptrexVery nice code. I could have never thought of that.
Chris86 Posted December 2, 2007 Author Posted December 2, 2007 @all This should get you all going (no external tools needed). #Include <Constants.au3> $s_Machine = InputBox("Input", "Please enter the name of the computer you want to reboot") $s_Command = InputBox("Input", "0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot " & _ "|8=Power Off|8+4=Forced Power Off") _RemoteShutdown($s_Machine, $s_Command) Func _RemoteShutdown(ByRef $s_Machine, ByRef $s_Command) Local $wbemFlagReturnImmediately, $wbemFlagForwardOnly, $objWMIService, $colItems, $objItem $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $objWMIService = ObjGet("winmgmts:\\" & $s_Machine & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT Name From Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ; 0=Log Off|0+4=Forced Log Off|1=Shutdown|1+4=Forced Shutdown|2=Reboot|2+4=Forced Reboot|8=Power Off|8+4=Forced Power Off For $objItem in $colItems $objItem.Win32ShutDown($s_Command) Next EndFunc; ==> _RemoteShutdown Please keep on smiling regards ptrexgot any codes that list all the computers on the network?
themax90 Posted December 2, 2007 Posted December 2, 2007 got any codes that list all the computers on the network?Jos has already provided an authentic answer to this question. Please read through the thread and view where he talks about Net View.
ChrisL Posted December 2, 2007 Posted December 2, 2007 I think that net view only shows computers in your own workgroup or domain, if you are looking for computers outside of your workgroup (if using workgroups) then your going to need a different method. unfortunately I don't have the answer but I thought I should make you aware [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Chris86 Posted December 3, 2007 Author Posted December 3, 2007 I think that net view only shows computers in your own workgroup or domain, if you are looking for computers outside of your workgroup (if using workgroups) then your going to need a different method. unfortunately I don't have the answer but I thought I should make you aware All my servers are in the same workgroup on my network
Confuzzled Posted December 15, 2007 Posted December 15, 2007 While you are using WMI to send the remote shutdown commands, could it also be used to ascertain which ones are visible across the network?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now