Sub topic 9
gpupdate, gpresult, shutdown, and winver
This chapter covers four Command Prompt tools that a technician uses to reapply policy, verify policy, control restarts, and identify the Windows version. It assumes you can open an elevated Command Prompt, read /? help, and know the difference between a local account and a domain account. Group Policy ideas appear here only as far as the commands need them. The editors for policy are covered in a later chapter.
Group Policy in one paragraph
Group Policy is a Windows feature that applies configuration settings to computers and users. In a domain, an administrator sets policies centrally, and each computer downloads them. Settings fall into two scopes: Computer Configuration applies to the machine no matter who signs in, and User Configuration applies to the signed-in user. Windows refreshes policy by itself about every 90 minutes on a workstation, with a random offset of up to 30 minutes. It also refreshes at startup (computer policy) and at sign-in (user policy). Waiting for that cycle is slow when you are testing a change, so you force it with gpupdate.
gpupdate: reapply policy now
gpupdate asks the computer to contact its policy source and apply any new or changed settings. By default it processes only settings that changed since the last refresh.
gpupdate /force/force reapplies all policy settings, not only the changed ones. Use it when a setting seems to be missing, or after you have moved a computer to a different organizational unit.
| Switch | Effect |
|---|---|
| `/force` | Reapply all policies, changed or not |
| `/target:computer` | Refresh only Computer Configuration |
| `/target:user` | Refresh only User Configuration |
| `/logoff` | Sign the user out after refresh, if a setting needs it |
| `/boot` | Restart after refresh, if a setting needs it |
Some settings cannot take effect while a user is signed in. Software installation and folder redirection are examples. In those cases gpupdate prints a message that a sign-out or restart is required. Do not ignore it. The policy has been downloaded but it is not active until the user signs out or the machine restarts.
A common error is running gpupdate on a computer that cannot reach a domain controller, which is the server that supplies domain policy. The command then reports that it could not contact the domain. Check the network first with the tools from the earlier network chapters, then run gpupdate again.
gpresult: verify what was applied
gpupdate pushes policy in. gpresult shows what actually applied. This is the tool to use when a user says a setting is not working.
gpresult /r/r prints a summary in the console. It lists the computer's domain and site, the last time policy was applied, and which Group Policy Objects (GPOs) were applied or filtered out. A GPO is a named collection of policy settings. The output is split into a Computer Settings section and a User Settings section.
For more detail, write a report file:
gpresult /h C:\Temp\gp-report.html/h creates an HTML report that you open in a browser. It shows each individual setting, its value, and which GPO supplied it. The folder must already exist. Use /f to overwrite an existing report.
Two details cause many wrong results:
- Elevation. Without an elevated prompt,
gpresult /rcan show user data but fails to show computer data, with a message about insufficient rights. Open Command Prompt as administrator. - Scope. Use
/scope:useror/scope:computerto show one half. Use/user DOMAIN\nameto view the result for another user who has signed in on this machine.
A typical workflow is to run gpupdate /force, then gpresult /r, and check that the expected GPO appears under "Applied Group Policy Objects". If it appears under "The following GPOs were not applied because they were filtered out", the GPO's security filtering or link location excludes this computer or user.
shutdown: restart, power off, or sign out
shutdown controls power state from the command line, locally or on another computer.
shutdown /r /t 60 /c "Restarting for maintenance"
shutdown /aThe first command restarts after 60 seconds and shows the comment to the user. The second aborts a pending shutdown during that countdown.
| Switch | Meaning |
|---|---|
| `/s` | Shut down |
| `/r` | Restart |
| `/l` | Log off the current user |
| `/h` | Hibernate |
| `/t N` | Wait N seconds before acting. The default is 30 |
| `/c "text"` | Show a comment, up to 512 characters |
| `/f` | Force running applications to close without warning |
| `/a` | Abort a pending shutdown |
| `/m \\computer` | Target a remote computer |
Edge cases worth knowing:
/t 0acts immediately. You cannot abort it./fcan cause unsaved work to be lost. Use it for stuck systems, not as a habit./lcannot be combined with/m, so you cannot log off a remote user this way.- Remote shutdown needs administrator rights on the target, and the firewall and remote services must allow it.
shutdown /r /orestarts into the advanced boot options menu, which gives access to Safe Mode and recovery tools.- A normal
/son modern Windows uses fast startup, which saves part of the system state. To get a full cold boot, use/ror turn fast startup off.
winver: identify the Windows version
winver opens a small dialog showing the Windows edition, version (such as 22H2), and OS build number. You can run it from Command Prompt, the Run box, or the Start menu.
winverVersion matters because support dates, feature availability, and update eligibility depend on it. A feature update that needs a certain build will not install on an older one. For more detail, such as hardware and system information, use msinfo32, which is covered in a later chapter. ver is a related command that prints the version number in the console, but winver is the one the exam names.
Putting the four together
Rather than a diagram, use this order of work when a policy change does not seem to take effect:
- Run
winverto confirm the edition supports the policy. Some policy editors and settings are missing from Home editions. - Run
gpupdate /forcein an elevated prompt. - Run
gpresult /rand look for the GPO in the applied list. - If the message said a restart or sign-out is required, use
shutdown /r /t 0orshutdown /l.
Common errors
- Running
gpresultwithout elevation and trusting the incomplete output. - Assuming
gpupdatetakes effect immediately for every setting. - Using
shutdown /sand expecting a full restart. - Typing
/t 0with/ron a remote server by mistake, which restarts it at once.
Exercise
A user on a domain-joined PC reports that a new drive-mapping policy is not applied. You open an elevated prompt. Which two commands do you run, in which order, and what do you look for in the output?
Show answer
Run gpupdate /force to reapply all policy, then gpresult /r to verify. Look for the GPO under "Applied Group Policy Objects" in the User Settings section. If it is listed as filtered out, the problem is the GPO's link or security filtering. If gpupdate asks for a sign-out, sign out and check again.
Exercise
You started shutdown /r /t 120 by mistake. How do you stop it, and why would /t 0 have prevented that?
Show answer
Run shutdown /a within the 120 seconds to abort the restart. With /t 0 the action happens at once, so there is no countdown in which to abort.