Discussion Locked

shutdown.exe related questions. "Access Denied" message. batch file not wor

0 helpful
28 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hello there, i have this room with 37 computers in my school, that i need to be able to shutdown just by pressing something on my so-called-server computer :). all the computers are running WinXP. ALL of them have sequent IP addresses and names, and ABSOLUTELY THE SAME administrator account.

username: admin01
pass: pass01

all firewalls have been disabled on all the computers. if i execute the shutdown command with the -m option it will work for all computers except 4 of them - these 4 give me the "Access Denied" message on shutdown.exe execution. These 4 are the newest computers on the classroom, but still, there is nothing different or special about them... at least none that i know of... they've got the same admin account, no firewall, same OS... Everything is accessible on them just as any other computer, file sharing, Remote Desktop, etc. I don't know why it WON'T let me shutdown them remotely, drives me crazy! I searched the internet, and it seems, there are other people experiencing the same thing, but yet, i coudn't identify a solution...

second thing, as i said i need to make the shutdown process for all the computers as short as possible, that's why i went for a batch file. The shutdown command executed by the batch file will discard additional option like -r (restart), -f (force quit), the only option will not discard is the -m option. So if my first line in the .bat file is:

shutdown -m \\computer01 -r -f

it will only shutdown computer01, no restart and no force quiting of applications

pls help, if you know how :) thanks thanks thanks

28 replies

by nonapeptide

This thread gives some hope:

http://www.msfn.org/board/lofiversion/index.php/t50208.html

Take note of the psshutdown suggestion. Actually, the whole PSTools suite is very usefull http://www.microsoft.com/technet/sysinternals/utilities/pstools.mspx

Here's another thread (If you have a Experts-Exchange account): http://www.experts-exchange.com/Operating_Systems/WinXP/Q_20756919.html

Take particular note of the comment at this time: 10.06.2003 at 12:55PM PDT, ID: 9500644 The comment talks about a rather obscure registry key that forces a logon as a guest. Also, you can't disable that for XP Home (I hope you have Pro).

Oh, and if you don't have an E-E account, here's where you can get a free one: http://www.experts-exchange.com/registerFree2.jsp (yes, it's truly free, not the "Free Trial" that they try and hook you into)

Let us know what happens.

by scott_heath

Check the Event Logs for error messages on the remote system.

Or try a WMI based vbscript. Try this:

First you will need to build your collection or array of computernames. There are lots of ways to do this, if you need help ask and I'll demonstrate one. Lets pretend the variable sComputerName is one of the computers in question.

Set colOperatingSystems = GetObject("winmgmts:\\" & sComputerName & "\root\CIMV2").ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(2)
Next

This worked fine in my lab. I ran it as local admin on my box making sure the other box had the same local admin password.

Let me know if I can help.

by roise4000

uh man... this really looks complicated... i don't understand most of it... :( but I've got good news though... the batch file thing started working as soon as i fixed the ForceGuest thing... i don't know how... i have no idea why, i know there isn't any connection between the two :), but yet... it works now :) lol

by roise4000

hello again... i am announcing that the problem with the "access denied" thing is officially over :) thanks Nonapeptide for the threads provided

it was actually the registry key thingie that forces you to logon as Guest on every network executed command...
the location of that registry entry is:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest" key
set to "0"
By the way: the same can be done by just disabling "Simple File Sharing" :)

by nonapeptide

Glad to hear things worked out. From what I understand, PSTools can be a big help especially for administering a group of workgroup computers. It seems like you could kinda fake a domain environment by using a common admin account on each machine and pushing out commands from a central machine (a poor man's domain controller).

Is this a classroom environment that gets rebuilt every semester or year (like a computer lab) or is it an environment that needs to be maintained as long as possible? Just curious...

Nonapeptide

by roise4000

it doesn't get rebuild every semester, but a lot of sh*t happens because of students :) and needs to be constantly maintained... and i have been working lately on various ways to limit users access to various things, like blocking screen saver changes, or wallpaper changes, and blocking certain programs. i am having kinda hard time, because they (the students) are not supposed to be able to access certain stuff which are accessible by default, but yet ... they must be able to do other stuff, which by default is not accessible...like changing the default Word template... and basically stuff like this :)

by roise4000

1. now my next problem that derives from this one is: "i need to change this key for every and single computer that has this set to "1". i am lucky that only four of those computers have this issue, but what if there were a lot more. is there a way to lunch another command and change certain reg key form the network... but then, even if it was possible, this little key wouldn't let it, cause it forces you do log on as guest no matter what, which leads to unableness to alter registry values :))) right??!! :)

2. Is there a way to specify on the regular shutdown.exe username and passwords, like with the psshutdown.exe. is it something with /user:usename pass:password ????

3. I remember there was a way to make a file accessible anytime just by typing its name, regardless of its location or your location from where you are executing the file

for example: i can execute shutdown from my desktop or from c:\, or from any random directory... i want to be able to do this with psshutdown also... i remember there was something in the home path or root structure or something

by nonapeptide

1. Errr... scripting is not my strong point. However, someone else on TR could probably help you out with that one.

Have you tried to connect to the registry remotely? E.g. run >> regedit >> file >> connect to network registry >> [compname] At least that way you could do it without having to visit each workstation.

2. If I understand your question correctly this should do it: runas /user:[domain]\[user] "shutdown.exe [enter switches here]" Take a look at the switches for runas to see if anything else could be of use to you.

3. Try dropping psshutdown in the system32 folder on the machine that you want to run it from.

Does that help you?

by roise4000

1, 2. it was stupid to ask actually if i could alter the registry remotely while the very option i am trying to change is the one that forbids the remote access :) i.e. i was trying to change in the registry the option that would let me to change the registry :) sounds confusing, i know :)... so that didn't work

3. i totally forgot about that... thank you - that worked - dropping stuff on the System32 folder

by roise4000

ok... so far... psshutdown.exe works beautiful:), and the Windows SteadyState it's REALLY cool :), i will attend to it more deeply, it has really helpful features exactly for what i need in this classroom, and i think other classrooms can take advantage of it also... thanks Nonapeptide, you have been so helpful to me, if you had a thumbs up thing, i would push it multiple times :)

here is my next two questions tough :)...I am sorry, you don't have to answer me anymore, i am kinda exceeding my quota here:)
but...
1. is there a command line execution of a wake-on-lan tool, just like this psshutdown, but now... i need it to wake-on-lan:)
2. here is the ultimate question... the master of all questions:)
:) do you think there is a way to enable remote desktop and configure a user for it through the network, ...in ANY way... registry editing?... command line executions?... or anything else? that is of course if this stupid ON-by-default winXP option that forces network-guest-login is OFF!

by scott_heath

You can definately turn it on remotely.

The key "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" has a setting "fDenyTSConnections" that has a DWORD value. Set it to 0, then you can use RDP.

Then just add users to the local group 'Remote Desktop users" and your good to go. if the user is an admin they do not need to be added.

by nonapeptide

I was in a Server 2003 administration class and had shut down remote desktop to keep a fellow student from "attacking" me (all in good sport, of course). However, he used this registry key to turn it back on and then used the "shadow" command to shadow my session and surprise me by taking control of my keyboard and mouse. So much fun. ;)

by roise4000

hi guys, i haven't had the chance to check if this registery key actually works for me, until today. i found out that it didn't :(... i connected remotely to the registery key of the target computer and i switched this key to "0". but still it says "the client could not connect to the remote computer"... i didn't do anything with the users though, because as u said ... if the account with which i am trying to connect to the target computer is an admin account, one doesn't have to do this... in fact the account FROM where i am trying to connect is also admin and it's the same, username and password, same as the target computer...

i was thinking maybe i should try to add him on the remote account anyway just to be sure... only if i new how to do this through remote registery ... :)

by scott_heath

I hear ya bro!

I am a pretty good Google-ite and everyone thinks I'm just smart. I hear a conversation in the cube next to me sometimes, hit Google, get a bunch of info then wander over and join in. They all think I'm a Rhodes Scholar or something!

by roise4000

hello Nonapeptide, this "shadow" ability, is this build in to windows, what is it... is it something that will make remote desktop actually "interact" with the user's desktop and not just log him off like regular RD does...

by nonapeptide

The "shadow" command is only usable for the Windows Server OS. Although, I think someone hacked XP to do it by swapping a few DLLs, that would definitely violate your EULA with Microsoft (that whole 'concurrent user' thing).

Go to a Server 2003 machine, open up a command prompt, and type "shadow /?" (no quotes of course). Or do a Google search on "windows shadow command".

by scott_heath

...on port 3389. Go to a command prompt and type "telnet 3389" and press enter. If it makes a connection then at least yuo know the service is enabled. If it won't make a connection then either the service isn't running or something is blocking the traffic.

by roise4000

hmm... It seems that enabling RD remotely through the registry won't automatically open port 3389 as it does when you enable it through the system preferences... that meaning that my next question would be ... "how do i open port 3389 remotely through the registry" :) i know that by now you may think that i am probably trying to hack into someone's computer, but i guaranty you that's not the case... i take full responsibility for my actions :)

P.S. oh.. still it would be nice to know how to add users remotely :)))

by nonapeptide

There are two ways that I think would work:

You could try to unblock the program:

run >> mmc >> file menu >> add remove snap-ins >> add >> group policy object editor >> browse for the computer on the workgroup that you want (yes, you'll need to do this for each individual computer, unless some scripting genius can figure out how to automate it) >> go back to the mmc and open Local Computer Policy >> Computer Configuration >> Administrative Templates >> Network >> Network Connections >> Windows Firewall >> Next, I'm assuming you would select Standard Profile over Domain Profile >> Then select the policy "Windows Firewall: Define Program Exceptions". From there, you'd have to figure out which program to unblock. It'll proabbly be mstsc.exe, but I'm not certain.

Or, you could just use netsh to ublock ports: http://www.jsifaq.com/SF/Tips/Tip.aspx?id=7907

You decide which one you want to mess with. My guess is the second one. :) (Which, incidentally, would be easier to script).

As for adding users remotely:

Go to the computer management console (run >> compmgmt.msc), right-click "Computer Management (Local)" and select "Connect to another computer". Attach to one of the workgroup computers and then go to the "Local Users and Groups" node. Select "Groups" and then you should be able to add a user to the Remote Desktop Users group.

How's that?

by roise4000

hello Nonapeptide, i am trying to give you many thumbs-up :), but it seems, it doesn't work or something, couse dependless of how many times i click it, keeps staying at "2". i can't tell you how helpful have you been... everything works nicely

here is a small summary of all that i have learned:
1. XP comes by default with the forceguest registry key at value: "1", but there is a chance that users using locally the machine would have changed the value to "0" as this key is directly connected to the "Use simple sharing" option, at Windows Explorer->tools->folder option. Without this key being reset to value:"0", none of the below would be applicable. It will just keeps saying "Access Denied" no matter what you try, and you cannot change this value remotely, because of this :)
2. once this key has been reset, in order to gain RD access to any computer without having to be infront of it, the fDeniTSConnections key needs also to be reset at "0", which NOW can be done remotely, I tried to find the equvalent switch option on the group policy manager, but with no luck, i reviewed all of the options under
GP->Computer Configuration->Administrative Templates->Windows Components->Terminal Services
3. finally you would have to open port 3389 for the RD to accept requests. Both ways that u described on how to do this work, but the second one, involving "netsh" works especially well with the psexec.exe tool, that i was referred to it earlier in this discussion:), i can make a list-file with all the computers i want to open that port on, and just run
psexec @[list-file] -u [username] -p [password] -s netsh firewall set portopen
ing TCP 3389 ENABLE
the snap-in way also works, but as u mentioned, it is a little more involved, and for some reason it won't apply any changed to the group policies, until you restart the system (using "netsh" applies changes instantly), although this way it would be kinda more "hard" to reverse the port opening as you would have to know about group policies and how to access them, as doing this through GP makes the "user way" :) of allowing or blocking port 3389 unavailable, which is not the case when using "netsh".

thank you ALL again for all the extraordinary help that you have provided, i feel more knowledgeable now in my own satisfaction :)

by nonapeptide

Wow, sounds like you've got things pretty well hammered down. It was refreshing to interact with someone who would take suggestions and do the research to apply them to their own situation. Sometimes I get the feeling that I'm doing someone's homework for them when I answer forum posts. Not this time. ;)

Hey, just out of curiosity, since you work in Lennox Cali at a school... are you a Lancer? If you don't know what I'm talking about, then you probably aren't. ;)

Come on back with any more questions that you have.

Nonapeptide

by tig2

With telling people the truth! Do you want to get us all canned?

Fact is that I have not one, but two Google windows open at all times. People think I'm the greatest thing since sliced bread but the truth is that I am a fast typist.

Never admit that you heard that from me. This is just between you and me!

by roise4000

are you referring to freelancing. meaning that i work whenever there is work to do, whenever somebody calls... well, unfortunately i am not, although i would like very much to be one at this stage of my life, it is just that i recently came from my country here, and i don't have enough contacts yet to be able to do that. i was lucky enough to find that job at this school as soon as i did. The problem is that the work to be done there is very limited and sometimes i feel like i am wasting my time. doing stuff that anyone with a 30minute education in computer science could do... :(, not very inspiring... but i am constantly looking for other opportunities.

by nonapeptide

Actually, when you said that you worked at a school in Lennox California, I looked and only found one: Lennox High School... who's mascot is the Lancer. So I thought you might be a "Lancer"

Anyway, keep up the good work. I enjoy your ability to take suggestions and then quickly implement them. that character trait is not as prevalent in this industry as I would like. Do very well with the things that you've been given to do and often new responsibilities will fall into your lap. If you want to search for things to do, I'm sure that you can find them.

Here's a very good book for you to read: http://www.amazon.com/Practice-System-Network-Administration-2nd/dp/0321492668/ref=sr_1_2?ie=UTF8&s=books&qid=1198696247&sr=1-2

It will be well worth your time. And while you're at it, nab a few certifications and join a few IT related message boards. You might want to join LinkedIn.com (free!) or LOPSA (not free).

Keep us posted on how things turn out.

This discussion is closed to new replies.