Scheduled Reboot

Specific time
at 04:00 shutdown -r -t 60 -f -d p:4:1 -c “Description here”

Day of the Month (eg 23rd)
at 21:40 /next:23 shutdown -r -t 60 -f -d p:4:1 -c “Description here”

Day of the week (M,T,W,Th,F,S,Su)
at 21:40 /next:W shutdown -r -t 60 -f -d p:4:1 -c “Description here”

The reason codes can be found in full by typing shutdown and pressing enter!
In the examples above it is Planned Application Maintenance

-r (Reboot)
-t 60 (in 60 Seconds)
-f (force programs to close)
-d p:4:1 (Planned application Maintenance)
-c “Description here” (write a note of “description here” into the logs)

The AT command has been depreciated but you can create a scheduled task for a reboot from the command line still…

schtasks /create /tn "Reboot" /tr "shutdown.exe -r -f -t 00" /sc ONCE /st 04:00:00 /sd 23/12/2020 /ru DOMAIN\USER /rp PASSWORD

https://support.microsoft.com/en-us/help/814596/how-to-use-schtasks-exe-to-schedule-tasks-in-windows-server-2003

VSS Fix

VSS Fix
Write a batch file containing the following:

cd /d %windir%\system32
Net stop vss
Net stop swprv
regsvr32 ole32.dll
regsvr32 oleaut32.dll
regsvr32 vss_ps.dll
vssvc /register
regsvr32 /i swprv.dll
regsvr32 /i eventcls.dll
regsvr32 es.dll
regsvr32 stdprov.dll
regsvr32 vssui.dll
regsvr32 msxml.dll
regsvr32 msxml3.dll
regsvr32 msxml4.dll
Net start vss
Net start swprv
pause

Kill a stuck Service

sc queryex [servicename]
taskkill /f /pid [PID]

Replace [servicename] with the services registry name. For example: Print Spooler is spooler.
Replace[PID] with the PID returned from the previous command.

Redircmp / Redirusr

Change the default location for new computers and users so that fresh objects can have GPOs applied (you cannot apply GPOs to the default Containers)

redirusr ou=myusers,DC=contoso,dc=com
redircmp ou=mycomputers,DC=contoso,dc=com

Telnet

At an Administrative Command Prompt enter “Telnet 192.168.0.1 389”, where 389 is the port you want to connect to on the host. If you are not sending SMTP you will just get an empty black screen if it works.

Robocopy

http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx

Eg. MOVES a folder and sub-directories without waiting and without retrying, strips off the security.
robocopy \\from\this\dir \\to\this\dir /e /zb /copy:DAT /r:0 /w:0 /mov

robocopy "E:\source\subfolder" "Q:\target\subfolder" /e /zb /copy:DAT /r:0 /w:0 /move

Note: if you are going to save this as a batch file, don’t call the batch file Robocopy.bat!
…and watch your speech marks. Word destroys them!

Install Mode on a TS

Before installing anything on a Terminal Server you need to put it into Install Mode, and then Execute Mode once you’ve finished!

change user /install
User session is ready to install applications.

change user /execute
User session is ready to execute applications.