Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 11th, 2008, 11:50 AM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
PowerShell - Script Will Not Run.

I'm trying to make a batch file to remotely shutdown a large group of servers. I have the necessary account privlages needed to run the script. But when I run a test version on my sandbox machines, the script returns an error saying it cannot find the machine. but if I ping the machine using the same address, it works fine. I figure this is something in the firewall, but I have RPC and file and print sharing opened up to the subnet, so I am not sure why it's not working.

Any Ideas?

I am running this on windows Server 2003. but the final version will need to shut down a few server 08 machines as well.

Reply With Quote
  #2  
Old September 11th, 2008, 09:48 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Can you post the code you're using? You've mentioned batch but chosen PowerShell for your thread subject.
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #3  
Old September 12th, 2008, 04:10 PM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
I am just doing a basic shutdown command as part of the rest of the script
I'm running as a domain administrator when I run this.

shutdown -s -m\\<address> -d1:1

and it says the machine is not found. but if I ping <address> it finds it.

What ports / services do I need open / running for this to work.

Reply With Quote
  #4  
Old September 13th, 2008, 04:49 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Are you using a host name or an IP address?

And there's a space between the m and the \\, btw.

Reply With Quote
  #5  
Old September 15th, 2008, 05:33 PM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
It does not work with a hostname or an IP.

Reply With Quote
  #6  
Old September 17th, 2008, 09:15 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
try with quotes:
Code:
shutdown -s -m "\\<address>" -d1:1

Reply With Quote
  #7  
Old September 18th, 2008, 08:50 AM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
There was a problem with the firewall blocking the command. I found a workaround and it works. thanks for the help.

Reply With Quote
  #8  
Old September 23rd, 2008, 09:30 AM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
Now I have a new problem.

how can I send a shutdown command, and then confirm that the machine is down before I continue with my script?

Reply With Quote
  #9  
Old September 23rd, 2008, 09:36 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
Quote:
Originally Posted by bwasson
Now I have a new problem.

how can I send a shutdown command, and then confirm that the machine is down before I continue with my script?
try pinging it. when it stop responding, you know it's down.

Reply With Quote
  #10  
Old September 23rd, 2008, 09:58 AM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
that's what I thought, but how do I tell my script to continue when it stops responding? if I do the ping -t command I assumed it would stop when it started to time out, but it doesn't stop, it just continues.

Reply With Quote
  #11  
Old September 23rd, 2008, 10:53 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
it's more complicated than this.
you'll have to ping once. analyze the results. if the server didn't respond,
continue. otherwise sleep for half second or second and ping again.

Reply With Quote
  #12  
Old September 23rd, 2008, 11:03 AM
bwasson bwasson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 9 bwasson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 49 sec
Reputation Power: 0
honestly the is the first script I've ever written in windows, (I've done bash before). so I have no idea how to analyze output like that.

do you know of a tutorial that would bring me up to speed quickly to do what I need to do?

Reply With Quote
  #13  
Old September 23rd, 2008, 11:10 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
Quote:
Originally Posted by bwasson
honestly the is the first script I've ever written in windows, (I've done bash before). so I have no idea how to analyze output like that.

do you know of a tutorial that would bring me up to speed quickly to do what I need to do?