Rebooting a workstation with failed auto-login
-
Wednesday, February 29, 2012 6:51 PM
Hello all not sure this is the correct place to post, but here it goes:
I am creating my 1st Powershell script. My target is XP thin clients that have dropped from our domain.
I need to:
1. Unlock the write filter
2. Reboot
3. Remove from domain
4. Re-join Domain
5. Lock write filter
6. RebootSounds easy enough. I was able to write the script and it tested perfectly, however when I tried it on actual Thin clients that have dropped I have a bug I cannot figure out.
Scenario:
The Thin clients are set to auto login with a restricted domain user account. When the trust fails, the auto-login will fail with a message about not being able to connect to a domain controller.
My reboot code:
psexec -sd \\$TargetComputer -u $TargetComputer\administrator -p $global:admpwd shutdown -r -t 00
I have tried with the –sd and without. Psexec is remote executing the shutdown command successfully, but Shutdown.exe Is reporting “The device is not ready.” Everything I have searched for says this was fixed in SP2. All of our thin clients are at SP3.
Has anyone seen this before?
Or is there another way to send a reboot other than shutdown.exe?
All Replies
-
Wednesday, February 29, 2012 7:13 PM
What if you run:
shutdown /r /t 0 /m \\$targetcomputer
?
Grant Ward, a.k.a. Bigteddy
-
Wednesday, February 29, 2012 7:17 PM
That does not work.
Because the trust has failed and I need to pass local admin credentials. Shutdown uses the rights of the originating logged on user.
-
Wednesday, February 29, 2012 7:18 PM
You can also try psshutdown.exe
http://technet.microsoft.com/en-us/sysinternals/bb897541
Grant Ward, a.k.a. Bigteddy
-
Wednesday, February 29, 2012 7:23 PMI belive I tried that. I will try it again and post results as soon as I have another Target to attempt (there are several a day).
-
Wednesday, February 29, 2012 7:30 PMPowerShells Restart-Computer?you can pass it creds so that will help with the trust thing but ifShutdown.exe and psshutdown.exe arent working, not sure that will resolveit.might want to take the question to a support forum.
Justin Rich
http://jrich523.wordpress.com
PowerShell V3 Guide (Technet)
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Wednesday, February 29, 2012 10:50 PM
OK results……getting closer
psshutdown \\$TargetComputer -r -u $TargetComputer\administrator -p $admnpwd -f -t 00
This command works..BUT…. the computer will not reboot until the Logon message is clicked
-
Thursday, March 01, 2012 1:03 AM
Anyone have any ideas?
The goal here is to make this as automated as possible
- Edited by NeoIsAlreadyTaken Thursday, March 01, 2012 1:12 AM
-
Thursday, March 01, 2012 4:57 AM
This is not a solution, it is a work-around. Why are your workstations "dropping off the domain"? In all my time this has never happened to me.
Find the cause of your problem, and all this scripting will not be needed.
Grant Ward, a.k.a. Bigteddy
-
Thursday, March 01, 2012 5:06 AMModerator
-
Thursday, March 01, 2012 5:10 PM
Per my 1st post --- "My target is XP thin clients that have dropped from our domain. "
@bigteddy You are absolutely correct this is a workaround until we figure out what the cause is. We believe it has to do with the FBWF on the thin clients, but this is off topic and I would like to find a solution to my issue.
@Yan the whole purpose of my script is to just that. We have over 8,000 thin clients on our network and it is time consuming dealing with a symptom instead of working on the cause.
-
Thursday, March 01, 2012 5:18 PM
I tried:
$LocalCreds = Get-Credential $TargetComputer\administrator
Restart-Computer -ComputerName $TargetComputer -force -Credential $LocalCredsIt retuns access denied:
Restart-Computer : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
At C:\Scripts\Rejoin a Domain.ps1:34 char:18
+ Restart-Computer <<<< -ComputerName $TargetComputer -force -Credential $LocalCreds
+ CategoryInfo : NotSpecified: (:) [Restart-Computer], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.RestartComputerCommand -
Thursday, March 01, 2012 5:44 PM
I recently had a computer that lost it's trust relationship to the domain. It displayed similar problems when trying to remote into it. In fact, this is what alerted me to the fact that the trust was destroyed. However, I didn't try to work with it's local credentials.
But I believe that the "Access denied" errors you are getting with all the restart methods are a result of this lost trust. Why local credentials don't work, I can't explain.
I am out of suggestions on this problem.
Grant Ward, a.k.a. Bigteddy
-
Thursday, March 01, 2012 5:46 PMyou should probably take this to the XP support forums, you might get somebetter answers. Its not really a tool problem, but a security problem. Itmight not even be possible because of security restrictions due to thefractured trust status..
Justin Rich
http://jrich523.wordpress.com
PowerShell V3 Guide (Technet)
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Thursday, March 01, 2012 6:38 PM
OK results……getting closer
psshutdown \\$TargetComputer -r -u $TargetComputer\administrator -p $admnpwd -f -t 00
This command works..BUT…. the computer will not reboot until the Logon message is clicked
The point is not what the message says..... I prob should have used a differant screen shot. If some has seen the issue of rebooting a workstation with a logon Message. let me know... I wil try some of the other forums thanks all for the input.
I did make a little movement
-
Friday, March 02, 2012 3:56 AM
I have had the same issue before and I can give you a workaround. However it is not recommended or supported in any way and should only be used as a last resort.
use psexec to connect to the remote system and taskkill the winlogon process. This will cause a blue screen error and reboot the system.
It is not pretty but in a pinch it will allow you to get the system back to a state where you can restore service.
-
Friday, March 02, 2012 1:12 PM
Neoalreadytaken, check this out:
Grant Ward, a.k.a. Bigteddy
-
Friday, March 02, 2012 10:25 PM
I have had the same issue before and I can give you a workaround. However it is not recommended or supported in any way and should only be used as a last resort.
use psexec to connect to the remote system and taskkill the winlogon process. This will cause a blue screen error and reboot the system.
It is not pretty but in a pinch it will allow you to get the system back to a state where you can restore service.
psexec \\$TargetComputer -u $TargetComputer\administrator -p $admnpwd taskkill /im winlogon.exe
ERROR: The process "winlogon.exe" with PID 692 could not be terminated.
Reason: This is critical system process. Utility cannot end this process.
psexec \\$TargetComputer -u $TargetComputer\administrator -p $admnpwd taskkill /fi "WINDOWTITLE eq Logon Message"
INFO: No tasks running with the specified criteria.
- Edited by NeoIsAlreadyTaken Friday, March 02, 2012 10:57 PM
-
Friday, March 02, 2012 10:27 PM
Neoalreadytaken, check this out:
Grant Ward, a.k.a. Bigteddy
I don't think this will work as the trust is already broken, but this info is definatly worth study. Could help of the trouble shooting the cause
Thank you

