none
Help: need to remote reboot a workstation with a logon message

    Pertanyaan

  •  

    I am writing a script in Powershell to reboot a workstation that is not in the current domain. I need the ability to pass local admin credentials

    Commands I have tried are:

    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.

    ALSO:

    psexec -sd \\$TargetComputer -u $TargetComputer\administrator -p $admnpwd shutdown -r -t 00

    RETURNS: Device not ready

    AND:

    $LocalCreds = Get-Credential $TargetComputer\administrator

    Restart-Computer -ComputerName $TargetComputer -force -Credential $LocalCreds

    RETURNS: Access denied

    ---------------------------------------------------------------------

    Does anyone have a way to reboot workstation that has a Logon Message up without someone being in front of computer?

    01 Maret 2012 19:25

Jawaban

  • Firewall is open on remote computer, wbem is active?

    if you try this commad from a command prompt. What are the results?

    net use \\atl-dc-01\ipc$ /user:user   Password 
    WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    again

    net use \\atl-dc-01\ipc$ /user:user   Password
    shutdown -f -r -t 100 -m  \\
    atl-dc-01


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!

    06 Maret 2012 17:42

Semua Balasan

  • The trick is simple

      First establish an authenticated connection to the remote  ipc$
      when the connecton is established, invoke the shutdown command

     then close the the ipc$

    $computer="my.computer.us" $user="mydomain\gastone.canali" $Password="mYp1ss+worD" net use \\$computer\ipc$ /user:$user $Password shutdown -f -r -t 100 -m \\$computer

    net use  \\$computer\ipc$ /del /yes



    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!

    02 Maret 2012 1:45
  • Results

    PS C:\> net use \\$computer\ipc$ /user:$user $Password
    The command completed successfully.

    PS C:\> shutdown -f -r -t 100 -m \\$computer
    The network path was not found.

    ----------------------------

    Nslookup returns the proper IP
     I can even map and access a drive--

    PS C:\> net use x: \\$computer\c$ /user:$user $Password
    The command completed successfully.

    PS C:\> x:
    PS X:\>


    02 Maret 2012 22:43
  • try

     net use x: \\tcoan04\ipc$ /user:$user $Password

    and post the result, I think the problem is the variable $computer

    post also

    echo $computer


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!


    02 Maret 2012 22:47
  • Yea I tried it from the command line with atcuall data and no variables same result (forgot to change computer name before post)
    And if the variables where bad I would not be able to map a drive letter
    02 Maret 2012 22:55
  • Have you tried using invoke-wmimethod on win32_process?  It has a -credential parameter.

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    03 Maret 2012 3:26
    Moderator
  • $pc=gwmi -query "Select * from Win32_OperatingSystem where Primary=TRUE " -ComputerName "atl-dc-01" $pc.shutdown

    or from a command prompt

     WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    again powershell

    $cred = get-credential domain\user
    $pc="atl-dc-01"
    (gwmi -comp $pc -cred $cred Win32_OperatingSystem).Shutdown()


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!



    05 Maret 2012 20:58
  • Still getting access denied from this approach

     

    Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

     

    This computer is not part of the domain so I modified the example to:

     

    $cred = get-credential $TargetComputer\administrator

     

    (gwmi -comp $TargetComputer -cred $cred Win32_OperatingSystem).Shutdown(6)

    06 Maret 2012 17:29
  • Firewall is open on remote computer, wbem is active?

    if you try this commad from a command prompt. What are the results?

    net use \\atl-dc-01\ipc$ /user:user   Password 
    WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    again

    net use \\atl-dc-01\ipc$ /user:user   Password
    shutdown -f -r -t 100 -m  \\
    atl-dc-01


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!

    06 Maret 2012 17:42
  • Firewall is open on remote computer, wbem is active?

    if you try this commad from a command prompt. What are the results?

    net use \\atl-dc-01\ipc$ /user:user   Password 
    WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    again

    net use \\atl-dc-01\ipc$ /user:user   Password
    shutdown -f -r -t 100 -m  \\
    atl-dc-01


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare
     

    net use \\atl-dc-01\ipc$ /user:user   Password 

    The trust relationship between this workstation and the primary domain failed.

    net use \\atl-dc-01\ipc$ /user: atl-dc-01\administrator Password 

    The command completed successfully.

    WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    Code = 0x80070005

    Description = Access is denied.

    Facility = Win32

    07 Maret 2012 18:38
  • Hi,

    It seems like you may have a configuration issue on that specific computer that we will not be able to address from afar in a forum.

    Bill

    07 Maret 2012 20:54
    Moderator
  • Hi,

    It seems like you may have a configuration issue on that specific computer that we will not be able to address from afar in a forum.

    Bill

    Then where is the proper place to request? and this is for about 2000 computers not just one.

    Seems like a simple task to reboot.... Shutdown.exe was suppose to have been fixed in SP2 with this issue.

    If this thread cannot help then who can help? Instead of just leaving this thread a dead end please suggest a next step.

    12 Maret 2012 18:43
  • Hi,

    The forum participants here volunteer time for free and there is no service-level agreement. If you need a definite resolution to your issue and the suggestions here don't help, then you will most likely need to engage a paid option, which is beyond the scope of this forum.

    Bill

    12 Maret 2012 18:49
    Moderator
  • Hi,

    It seems like you may have a configuration issue on that specific computer that we will not be able to address from afar in a forum.

    Bill

    Then where is the proper place to request? and this is for about 2000 computers not just one.

    Seems like a simple task to reboot.... Shutdown.exe was suppose to have been fixed in SP2 with this issue.

    If this thread cannot help then who can help? Instead of just leaving this thread a dead end please suggest a next step.

    http://support.microsoft.com

    You can also contact you system administraor or call in a consultant.

    Another possibility is to post in the OS forum for your specific OS.

    I have been using Shutdown for years and it has never been an issue on any properly working PC.

    This comamnd has never failed to work and there has never been a patch to fix anything with this command.  There have been patches that have fixed various OS hangs on shutdown.

    shutdown -m \\system1 -r -f -t 0

    This will remotely kick off an immediate shutdown and will force all programs to terminate.  There is no message and no wait.

    Access denied messages are usually a result of corruption to DCOM or WMI or the underlying system kernel and cannot be addressed by this forum.


    ¯\_(ツ)_/¯


    • Diedit oleh jrv 12 Maret 2012 18:55
    12 Maret 2012 18:53
  • I am a system admin. How else would I be able to add/remove computers from a Domain?
    A consultant should not be nessisary to find a way to reboot a computer

    I too have been using shutdown for years. It seems to be the Auto-Login + Domain Drop, that is causing shutdown.exe to display "Device not Ready"

    http://support.microsoft.com/kb/816938 <-- Was fixed in SP2

    DCOM is not corrupt... it is because the trust has failed, per thread disscussion of passing local admin creds
    The Windows XP forum seems to only be for SP3 issues, did I miss the mark there?

    --------------------------- Windows XP Forum -------------------------------

    This particular TechNet Forum is designed to assist Windows XP users with the installation of Service Pack 3 (SP3) for Windows XP.

    If your issue is not related to installation issues with SP3, please post your question in the more appropriate Microsoft Answers Forum.

    Thank you for your cooperation!

    ----------------------------MS Answers Forum---------------------

    Your Windows XP question is more complex than what is typically answered in the Microsoft Answers forums. It is better suited for the IT Pro audience on TechNet. Please post your question in the TechNet forum for assistance:

    http://social.technet.microsoft.com/Forums/en/itproxpsp/threads


    Hope the information helps.

    ---------------------------------------------------------------------------------------------

    So now I am caught in a FORUM LOOP..... /palm

    And I do appreciate all the help from everyone. I have not stated any expectation, demand, or requirement.

    There has to be more than 3 ways to reboot a workstation.
    Please if anyone has any new ideas please post.

    12 Maret 2012 20:44
  • Hi,

    As I said previously, it's not really possible for us to provide in-depth troubleshooting for your issue from afar in a peer-to-peer support forum. In addition, it would seem that this isn't a scripting issue--It seems more like your issue has something to do with the computer's security policy. I might try asking in a more appropriate forum.

    Bill

    12 Maret 2012 21:17
    Moderator
  • Please if anyone has any new ideas please post.

    I will continue scour the internet for this elusive “appropriate forum” as there appears to be none found at Microsoft.

    Those that actually tried to help, I thank you.
    If I find a solution I will post it.

    Neo is already taken the version of the Matrix you are in has failed.

    12 Maret 2012 21:41
  • I am a system admin. How else would I be able to add/remove computers from a Domain?
    A consultant should not be nessisary to find a way to reboot a computer

    I too have been using shutdown for years. It seems to be the Auto-Login + Domain Drop, that is causing shutdown.exe to display "Device not Ready"

    http://support.microsoft.com/kb/816938 <-- Was fixed in SP2

    DCOM is not corrupt... it is because the trust has failed, per thread disscussion of passing local admin creds
    The Windows XP forum seems to only be for SP3 issues, did I miss the mark there?

    --------------------------- Windows XP Forum -------------------------------

    This particular TechNet Forum is designed to assist Windows XP users with the installation of Service Pack 3 (SP3) for Windows XP.

    If your issue is not related to installation issues with SP3, please post your question in the more appropriate Microsoft Answers Forum.

    Thank you for your cooperation!

    ----------------------------MS Answers Forum---------------------

    Your Windows XP question is more complex than what is typically answered in the Microsoft Answers forums. It is better suited for the IT Pro audience on TechNet. Please post your question in the TechNet forum for assistance:

    http://social.technet.microsoft.com/Forums/en/itproxpsp/threads


    Hope the information helps.

    ---------------------------------------------------------------------------------------------

    So now I am caught in a FORUM LOOP..... /palm

    And I do appreciate all the help from everyone. I have not stated any expectation, demand, or requirement.

    There has to be more than 3 ways to reboot a workstation.
    Please if anyone has any new ideas please post.

    I think you are misreading the KB. It is for remote desktop sessions only and not for other forms of remote shutdowns.  It is a problem with the RDP software and that was what was fixed.

    This is the first time you have mentioned the "Device not ready" errror.

    There is a problem with the workstation then no amount of sripting is gouing to fix that.  You need to troubleshoot the workstation.  If it is not properly joined to the domain you may not be abe to access any advanced capabilities.  I have seent his happen when a workstaiopn was turned off for too long and then turned back on.  Only a visit to the console will fix that in most cases as the local admin account may not be able to authenticate.

    I recommend calling Microsoft support if you cannot determine how to fix the workstation.

    If you are a Microsoft Certified Administrator you will realize that there is a limit to what can be done once this kind of error occurs.

    I sympathize with you issue with the free support services.  They are limited and designed for end users more than for admins.  In commercial installations Microsoft prefers that you open a support issue and pay for it.  I have  ususally maintained a pack of support sessions and will, at times, have my clients pay for an MS support session.  The support tech are usually very good and will work through the issue until it is resolved for a single incident procie.

    Of course you can search other forums hoping that someone has had the exact same issue.  That may work but it could take quite a while.


    ¯\_(ツ)_/¯

    12 Maret 2012 21:51
  • Yea already moving on....

    ---------------------------------------------------------------------

    PS: Look at my original post....

    psexec -sd \\$TargetComputer -u $TargetComputer\administrator -p $admnpwd shutdown -r -t 00
    RETURNS: Device not ready

    12 Maret 2012 22:06
  • Yea already moving on....

    ---------------------------------------------------------------------

    PS: Look at my original post....

    psexec -sd \\$TargetComputer -u $TargetComputer\administrator -p $admnpwd shutdown -r -t 00
    RETURNS: Device not ready

    Sorry - I missed that.


    ¯\_(ツ)_/¯

    12 Maret 2012 23:16
  • Firewall is open on remote computer, wbem is active?

    if you try this commad from a command prompt. What are the results?

    net use \\atl-dc-01\ipc$ /user:user   Password 
    WMIC -node:"atl-dc-01" OS Where Primary=TRUE Call Shutdown

    again

    net use \\atl-dc-01\ipc$ /user:user   Password
    shutdown -f -r -t 100 -m  \\
    atl-dc-01


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!

    Gastone I am marking your reply and an answer as it was a good approach. The Moderators seem to want to stop the thread becasue the answer was not given in 3 or 4 posts, and want to mark WE CANT HELP YOU as an answer. This may be the final outcome. This may be a quitters way out. It seemed like I was getting good feedback and was very helpful. Untill the Mods came in.

    All in all thank you all for your feedback.


    21 Maret 2012 15:35
  • WMI an d shutdown problems are not part of scripting but are system maintenance issues.  Ther eis no help with that ain this forum.  YOU can go to the OS forum and post your issues there and possible find someone who has seen your wexact symptoms or you could spend some more time troubleshooting the systems that won't reboot.

    The code you have been given will work on a properly functioning system.  That part is up to you.


    ¯\_(ツ)_/¯

    21 Maret 2012 17:17
  • The Moderators seem to want to stop the thread becasue the answer was not given in 3 or 4 posts, and want to mark WE CANT HELP YOU as an answer.

    Hi,

    This is a scripting forum and it's beyond the scope of this forum to help with system maintenance issues that don't really have anything to do with scripting. Please keep in mind that this forum is largely moderated by volunteers and as such there is no service-level agreement.

    Bill

    21 Maret 2012 17:29
    Moderator
  • Last question --- How can I close a thread?
    The repeating of the same info over and over is just too funny.

    Unique Situations are not to be discussed! Now get back in your box. We dont do outside the box here.
    • Diedit oleh NeoIsAlreadyTaken 21 Maret 2012 18:25 sometimes the message doesn't get through.
    21 Maret 2012 18:01
  • Hi,

    Regarding the repetition - sometimes the message doesn't get through.

    The thread is considered closed when an answer is marked.

    Bill

    21 Maret 2012 18:02
    Moderator