|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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! |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
Are you using a host name or an IP address?
And there's a space between the m and the \\, btw. |
|
#5
|
|||
|
|||
|
It does not work with a hostname or an IP.
|
|
#6
|
||||
|
||||
|
try with quotes:
Code:
shutdown -s -m "\\<address>" -d1:1 |
|
#7
|
|||
|
|||
|
There was a problem with the firewall blocking the command. I found a workaround and it works. thanks for the help.
|
|
#8
|
|||
|
|||
|
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? |
|
#9
|
||||
|
||||
|
Quote:
|
|
#10
|
|||
|
|||
|
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.
|
|
#11
|
||||
|
||||
|
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. |
|
#12
|
|||
|
|||
|
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? |
|
#13
|
||||
|
||||
|
Quote:
|