Sub topic 8
gpupdate, gpresult, shutdown, and winver
This chapter assumes you can open an elevated Command Prompt and read a command's help with /?. It also assumes you know what a Group Policy setting is: a rule that controls how Windows behaves, set once and applied to many computers or users.
Applying policy with gpupdate
Windows refreshes Group Policy in the background, about every 90 minutes on a workstation. When you change a policy and need it now, run gpupdate. It reapplies only the settings that changed.
gpupdate /forcereapplies every setting, changed or not./target:computeror/target:userlimits the refresh to one half of the policy.- Some settings, such as software installation and folder redirection, take effect only at the next sign-in or restart.
gpupdatethen prompts you to log off or restart.
Checking policy with gpresult
gpresult reports which policies actually applied. It answers the question "Did my setting arrive?"
gpupdate /force
gpresult /r/r prints a summary: the Group Policy Objects (GPOs) that applied, the ones that were filtered out, and the security groups involved. For more detail, /h report.html writes an HTML report, and /scope:computer or /scope:user narrows the output. Run it from an elevated prompt to see the computer settings.
Restarting with shutdown
The shutdown command controls power from the command line, including on remote computers.
| Switch | Meaning |
|---|---|
| `/s` | Shut down |
| `/r` | Restart |
| `/l` | Log off |
| `/h` | Hibernate |
| `/t N` | Wait N seconds first (default 30) |
| `/c "text"` | Show a message to users |
| `/f` | Force running applications to close |
| `/a` | Abort a pending shutdown |
| `/m \\name` | Target a remote computer |
shutdown /r /t 60 /c "Restarting for maintenance"
shutdown /aThe first command restarts the computer after 60 seconds and shows the message. The second cancels it, but only during the countdown. Use /f with care, because unsaved work is lost.
Identifying the build with winver
winver opens a small window showing the Windows edition, version, and OS build number. A technician checks it before installing a feature update or software that supports only certain versions. msinfo32, covered later, gives far more detail.
Common errors
- Access denied from gpresult: the prompt is not elevated, so computer settings cannot be read.
- Policy seems missing: the setting needs a sign-in or restart, or a GPO filter blocked it. Check the "denied" list in the
gpresultoutput. - Shutdown ignored: a later
/aor a missing/tvalue let the default 30-second timer run. Set/texplicitly.
Exercise
You changed a Group Policy setting on a domain server, and a user's PC has not received it yet. Which two commands apply the policy immediately and then confirm which policies took effect?
Show answer
Run gpupdate /force to reapply all policies, then gpresult /r to list the applied and denied GPOs. If the setting needs a restart, use shutdown /r /t 0.
Exercise
You started shutdown /r /t 600 by mistake. How do you cancel it?
Show answer
Run shutdown /a before the 600 seconds expire.