Update 2012 R2 with CMD command line

Margo hda 1 Reputation point
2022-04-22T09:26:50.35+00:00

04/22/2022 - 11:24

Hello,

I am studying in a computer science school, and I work in a telecommunication company (sandwich course). I have a project to do to validate my year.
I have a Windows server 2012 R2.
My goal is to update my computer with command lines.
I have the constraint to use only CMD and not Powershell.
I found the following commands on internet:
wuauclt.exe /detectnow /updatenow
Once I have run them, I unfortunately have no direct return to the CMD window.

Do you know other command lines ?
Don't hesitate to ask me questions, if you don't understand something, or if you need more information.
I will make updates if I find new things.
Thanks in advance for your feedback.
(Sorry, for my bad English)

Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,532 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,171 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Adam J. Marshall 8,706 Reputation points MVP
    2022-04-22T12:30:01.787+00:00
    2 people found this answer helpful.

  2. Rita Hu -MSFT 9,626 Reputation points
    2022-04-25T08:56:00.503+00:00

    @Margo hda
    We could add the related registry value to push the Server scan for updates from the internet. Here is related link for you:
    https://learn.microsoft.com/en-us/windows/deployment/update/waas-wu-settings#configuring-automatic-updates-by-editing-the-registry

    Reference command:
    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU /V AUOptions /T REG_DWORD /D 4

    Here is a related screenshot for you:
    196062-7.png

    In addition, please refer to the Official Document to know more about reg add command:
    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/reg-add

    In additon, I attached my registry file for your reference:
    195997-auupates.log

    Best regards,

    Rita


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

  3. MotoX80 31,826 Reputation points
    2022-04-26T14:38:08.947+00:00

    The easiest solution is to use AD group policy and let the servers update themselves.

    https://learn.microsoft.com/en-us/windows-server/administration/windows-server-update-services/deploy/4-configure-group-policy-settings-for-automatic-updates

    We used a scheduled task to call a script because we had numerous requirements from both management and our application teams.

    • Patch database servers before web/app servers.
    • Look for long running "number crunching" processes and delay the install/reboot until those processes completed.
    • Gracefully shut down Oracle DB instances before the reboot.
    • After the 1st install and reboot, check to see if any other patches are now available and install them.
    • After the reboot, verify that any service that was set to start=automatic was running, and start them if they are stopped.

    There was a whole lot more that we did as part of the "patch weekend" process. We were updating thousands of servers.

    With "only" 200 servers you should be able to do that with a spreadsheet and a couple of Powershell scripts.

    There are lots of examples on the internet. Find something that fits your organization's requirements and try it out on few test servers first to see how it works.

    https://www.bing.com/search?q=powershell+install+updates+script

    https://petri.com/how-to-manage-windows-update-using-powershell/

    2 people found this answer helpful.
    0 comments No comments

  4. MotoX80 31,826 Reputation points
    2022-04-25T19:39:03.287+00:00

    Why can't you use Powershell?

    https://learn.microsoft.com/en-us/windows-server/get-started/removed-deprecated-features-windows-server-2016

    Windows Update The wuauclt.exe /detectnow command has been removed and is no longer supported. To trigger a scan for updates, run these PowerShell commands:
    $AutoUpdates = New-Object -ComObject "Microsoft.Update.AutoUpdate"
    $AutoUpdates.DetectNow()

    While it doesn't apply to your 2012 R2 server's use of wuauclt, MS's direction for server administration is (has been for years) Powershell.

    Years ago I wrote a VB script (pre Powershell days) that used that com interface to install the updates on the servers for my company. I didn't have much luck with wuauclt. I found it rather frustrating that "wuauclt /? or /help or sdfflhgdb" produced no output. Poor design if you ask me. There should be console output to report what it did.

    I have found posts that indicate that usoclient.exe can do installs. You could try that if it's on 2012R2.

    https://social.technet.microsoft.com/Forums/windows/en-US/c18a95b4-2235-49e8-a1b2-fb47bd0111ab/run-windows-update-from-commandline-manually-cause-update-check

    https://omgdebugging.com/2017/10/09/command-line-equivalent-of-wuauclt-in-windows-10-windows-server-2016/

    If it were me, I would be advocating for Powershell.

    1 person found this answer helpful.