Windows
Microsoft's main Operating System.
Most of these notes are from before 2015. They were auto-converted, and not cleaned up very well, so there are lots of formatting weirdnesses.
Tips
Mount a drive using CLI:
net use z: \\servername\sharename password /USER:username
Disable 128 bit encryption requirement for CIFS shares:
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v LmCompatibilityLevel /t REG_DWORD /d 1 /f
Generate new SID:
c:\windows\system32\sysprep\sysprep.exe /generalize /reboot /quiet
Get system serial number:
wmic bios get /format:list | find "Serial"
Disable balloon tips:
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v EnableBalloonTips /t REG_DWORD /d 0 /f
Disable tray auto-hide:
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer /t REG_DWORD /v EnableAutoTray /d 0 /f
Add a scheduled task to defrag windows every morning:
schtasks /create /tn "Defrag C and D" /sc DAILY /st 03:01:00 /tr "defrag c: & defrag d:" /ru "domain\administrator"
Add a scheduled task to start dropbox at 11pm:
C:\Users\zerocool>SchTasks /Create /SC DAILY /TN "Start Dropbox" /ST 23:00 /TR "C:\Users\zerocool\AppData\Roaming\Dropbox\bin\Dropbox.exe /home"
Allow non-windows non-AD systems to submit their own hostnames to DNS, Add dhcpservice to the DnsUpdateProxy group
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v LmCompatibilityLevel /t REG_DWORD /d 1 /f
Enable auto-login: start -> run -> control userpasswords2
HKEY\_LOCAL\_MACHINE/SYSTEM/CurrentControlSet/Services
and can be deleted via the sc
command line.
Edit a lot of policies via the Active Directory Services Interface editor - Adsiedit.msc
Enable DNS debugging:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\" /v "13 Name Resolution" /t REG_DWORD /d 1 /f ; net stop "DNS Server" ; net start "DNS Server"
RSOP.msc will allow you to see the policy that is in effect on the given computer.
Create a symlink from a remote UNC folder to a local directory:
mklink /D c:\lysithea-shared\ \\lysithea\shared
Enable Telnet Server
This isn't really advisable except for when you *really* need it, like remote PowerCLI.
Configure telnet server to auto-start: sc config TlntSvr start=auto
Start telnet server:
sc start TlntSvr
Configure telnet server to not require NTLM auth, allowing password auth:
tlntadmn config sec=-NTLM
Configure stream mode (apparently makes things better for unix clients)
tlntadmn config mode=stream
Remotely uninstall graphical interfaces on Windows Server 2012
Uninstall-WindowsFeature -ComputerName "<server>" -Name Server-Gui-Mgmt-Infra, Server-Gui-Shell -Restart
Bootable hard drive install
Use the Windows 7 USB/DVD download tool, but if that doesn't work, this should work newer than XP:
- Attach hard disk
- Format as NTFS
- Set partition as active
- xcopy d:\*.* /e/f/s e:\ (Where d: is the source media and e: is the hard disk)
- bootsect /nt60 e:
Configure NTP from CLI
Here are commands to enable NTP client to poll every 900 seconds:
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /v Type /t REG_SZ /d "NTP" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /v NtpServer /t REG_SZ /d "0.us.pool.ntp.org,0x1 1.us.pool.ntp.org,0x1 2.us.pool.ntp.org,0x1" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /v SpecialPollInterval /t REG_DWORD /d 00000900 /f
net stop w32time && net start w32time
Replication checking
repadmin /showrepl
In-place upgrade between editions
dism /online /set-edition:ServerEnterprise /productkey:sdfjk-asldf-jkals-dfjsj-asdfk
Group Policies
Win2003 can use gpmc.msc to make things easier
gpedit.msc to edit some policies
Retrieve product key
This is useful to do as soon as you buy a new computer that came pre-installed with Windows OEM.
wmic path softwareLicensingService get OA3xOriginalProductKey
Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform").BackupProductKeyDefault
Links
- https://www.manageengine.com/products/self-service-password: Active Directory Self Service password resets
- https://ninite.com: Automated installation of many apps
- https://www.robvanderwoude.com/ntadmincommands.php: "Useful commands for Windows administrators"
- https://chocolatey.org: "The Package Manager for Windows"