10/20/2015
Reverse DNS records not registered when using DHCP
Windows client > NIC > ipv4 > check the box named:
Use this connection's DNS suffix in DNS registration
10/18/2014
Windows Server 2008R2 Disk Cleanup Utility
You can run it without installing Desktop Experience feature by doing the following:
Copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe /verylowdisk
You can put the above in a BAT file and it will copy the files and run without user intervention.
Or just copy the files and run it to select options.
run using cleanmgr.exe /? to see interesting switches for saving your selected options.
3/03/2014
Windows Domain Time Sync
Windows Domain Time Sync
Do the following on servers/workstations to point them to the domain as time reference and sync time:2/18/2014
Windows 2008 R2 multiprocessor HAL
Windows 2008 R2 - Switch to multiprocessor HAL
1. See the current HAL version: Open Device Manager and Expand COMPUTER Right-click the HAL and go to drivers tab and Update Driver to install a new one. 2. msconfig -> boot options -> advanced -> Confirm that the # processors is not defined there - uncheck the box. Also from here, there is option to "rescan for HAL"2/04/2014
Catalyst Switches for Microsoft Network Load Balancing Configuration Example - Cisco Systems
10/08/2013
The Cable Guy: Strong and Weak Host Models
Multihomed server configuration
8/12/2013
Lock Windows Workstation
rundll32.exe user32.dll, LockWorkStation
7/30/2013
Powershell - Change Service Startup Type
Powershell: Change Windows Service Startup Type of Remote Server
Works with Powershell 1.0 & 2.0
#Check Startup Type
($svc = Get-WmiObject Win32_Service -ComputerName $server -Filter "name='wuauserv'") | out-null
if ($svc.StartMode -eq "Disabled") {
"$server WSUS service changed to Automatic"
$result=$svc.changestartmode("Automatic")
}#end if
#Backup Service Registry
$result=([WmiClass]"\\$server\ROOT\CIMV2:Win32_Process").create("c:\windows\regedit /e c:\WSUS.REG HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv")
write $server "Backup Service Registry RESULT=" $result.returnvalue
#Set Service as Delayed Start
write $server "configure service"
$key = "SYSTEM\CurrentControlSet\Services\wuauserv"
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$regKey = $reg.OpenSubKey($key, $true)
$result = $regKey.setvalue("DelayedAutoStart", "1", "DWORD")
7/26/2013
Powershell: Status of Windows Hotfix
Powershell: Check Status of Windows Hotfix
##################################################################################
#
# check-hotfix.ps1
#
# Confirm hotfix has been installed on all Windows2008 servers
#
# Requires admin permission on every server
#
##################################################################################
$hotfix = "KB2520155"
$ServerList = ".\SUCCESS.TXT" #servers where hotfix is installed
$ErrorList = ".\ERRORS.TXT" #servers where hotfix is not installed
$ListFile = ".\SERVERS.TXT" #all the servers I checked
New-Item $ListFile -Type file -Force >$nul
New-Item $ServerList -Type file -Force >$nul
New-Item $ErrorList -Type file -Force >$nul
$today = get-date
$day = $today.Day
$mth = $today.Month
$year = $today.Year
$hour = $today.Hour
$min = $today.Minute
$sec = $today.Second
$date = "$year-$mth-$day-$hour$min$sec"
@"
$date
Servers Responding to PING
--------------------------------------------------------------------------
"@ | out-file -encoding ASCII -filepath $ListFile
@"
$date
Servers with hotfix $hotfix
--------------------------------------------------------------------------
"@ | out-file -encoding ASCII -filepath $ServerList
@"
$date
Servers without hotfix $hotfix
--------------------------------------------------------------------------
"@ | out-file -encoding ASCII -filepath $ErrorList
$List = ""
"Execution in progress..."
# Create $list of AD machine accounts for Windows Servers
$strCategory = "computer"
$strOS = "Windows*Server*2008*"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = ("OperatingSystem=$strOS")
$colProplist = "dnshostname", "operatingsystem"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults) {
$objComputer = $objResult.Properties;
$Server = $objComputer.dnshostname
$OS = $objComputer.operatingsystem
$Server = $Server -replace "\.usa\.DOMAIN\.com", ""
$Server = $Server -replace "\s{2,}", ""
$OS = $OS -replace "$([char]0x00AE)" , "" #remove "registered trademark" symbol
if ($Server) {#skip null
"$Server , $OS"
if (Test-Connection -ComputerName $Server -quiet -count 1) {#PING OK
" Responds to PING"
"$Server , $OS" | out-file -encoding ASCII -filepath $ListFile -append
#Get Hotfix info
$installed = get-wmiobject -class "Win32_QuickFixEngineering" -namespace "root\CIMV2" -computername $strComputer `
-Filter "HotFixID='$hotfix'"
if ($installed) {
" $hotfix INSTALLED!"
write-output "$Server , $OS" | out-file -encoding ASCII -filepath $ServerList -append
}
else {
" $hotfix NOT installed"
write-output "$Server , $OS" | out-file -encoding ASCII -filepath $ErrorList -append
}
}#end if PING OK, do nothing if PING fails
}#if not null, do nothing if null
}#foreach
7/12/2013
Windows 8 Help
shortcut keys
- Start Screen: to get there, press the key on your keyboard with the "Windows" flag. I'll type that as "[w]" from now on.
- Desktop: [w]+d
- Charms: [w]+c
- Settings, the Metro-ish Control Panel: [w]+I
- Lock Orientation so it doesn't jump between portrait and landscape with [w]+O
- Explorer is a pain to get more than one window open at a time but [w]+E always brings up a new Explorer window
- Many administrative tools can be accessed more quickly with [w]+x
- The new Metro modern apps have a wonky menu structure so to see every option all at once, [w]+z
7/02/2013
SYSPREP on cloned Windows Server 2008 R2 Fails
9/11/2012
Understanding Disk
Alignment



VMFS Alignment
NTFS Alignment
Windows 2003 and older align on 32K which will not match up with the 64K for VMFS. Windows
2008 by default will align on a 1024K boundary – this works with VMFS because
1024K is divisible by 64K.
7/20/2012
Export DNS Zone
DNSCMD is a great utility
One of the many things you can do is backup a zone:
Oddly, you can't put that output anyplace other than the default:dnscmd SERVERNAME /ZoneExport domain.com DNS-BACKUP.TXT
C:\WINDOWS\SYSTEM32\DNS\
7/16/2012
Windows DNS TTL
I guess a lot of people just are going to say "DUH!!!" but I had to look hard today to figure out how to add a TTL to an individual DNS entry on MS DNS server.
VIEW > ADVANCED gives you the secret field to fill in the TTL
Sheesh!
2/23/2012
Mapped Drive Connection to Network Share May Be Lost
9/04/2011
Powershell: reset WSUS client for list of servers
##################################################################################
#
# WSUS Client Cleanup and Reinitialize
#
##################################################################################
$today = get-date
$list = get-content LIST.TXT
"=========================================================================="
" WSUS Client Cleanup and Reinitialize"
$today
foreach($server in $list) {
"--------------------------------------------------------------------------"
#net stop wuauserv
($svc = Get-WmiObject Win32_Service -ComputerName $server -Filter "name='wuauserv'") | out-null
if ($svc.started -eq $true) {
write $server "stopping wuauserv"
$result=$svc.StopService()
}
($svc = Get-WmiObject Win32_Service -ComputerName $server -Filter "name='wuauserv'") | out-null
if ($svc.started -eq $false) {
write $server "wuauserv stopped"
}
#Backup Registry
$result=([WmiClass]"\\$server\ROOT\CIMV2:Win32_Process").create("c:\windows\regedit /e c:\WSUS.REG HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate")
write $server "Backup Registry RESULT=" $result.returnvalue
#Cleanup Registry
write $server "Reg Clean"
$key = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate"
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$regKey = $reg.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", $true)
if ($regKey.getvalue('AccountDomainSid')) {
$regKey.DeleteValue('AccountDomainSid')
"...removed AccountDomainSid"
}
if ($regKey.getvalue('PingID')) {
$regKey.DeleteValue('PingID')
"...removed PingID"
}
if ($regKey.getvalue('SusClientId')) {
$regKey.DeleteValue('SusClientId')
"...removed SusClientId"
}
$key2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
$regKey = $reg.OpenSubKey($key2, $true)
if ($regKey.getvalue('LastWaitTimeout')) {
$regKey.DeleteValue('LastWaitTimeout')
"...removed LastWaitTimeout"
}
if ($regKey.getvalue('DetectionStartTime')) {
$regKey.DeleteValue('DetectionStartTime')
"...removed DetectionStartTime"
}
if ($regKey.getvalue('NextDetectionTime')) {
$regKey.DeleteValue('NextDetectionTime')
"...removed NextDetectionTime"
}
if ($regKey.getvalue('AUState')) {
$regKey.DeleteValue('AUState')
"...removed AUState"
}
write $server "WSUS Reg Clean Completed"
#net start wuauserv
($svc = Get-WmiObject Win32_Service -ComputerName $server -Filter "name='wuauserv'") | out-null
if ($svc.StartMode -ne "Disabled") { $svc.StartService() | out-null } else {"wuauserv startup was disabled"}
($svc = Get-WmiObject Win32_Service -ComputerName $server -Filter "name='wuauserv'") | out-null
if ($svc.started) {
write $server "wuauserv started successfully"
}
#RESET WUAUCLT
$result=([WmiClass]"\\$server\ROOT\CIMV2:Win32_Process").create("wuauclt /resetauthorization /detectnow")
write $server "wuauclt reset RESULT=" $result.returnvalue
} #foreach
"=========================================================================="
##################################################################################
#is it necessary to clear WMI connections to free resources? If so how?
#if exist before attempting reg key remove
#RESULT CODES
# 0 {"$s Successful Completion."}
# 2 {"$s Access Denied."}
# 3 {"$s Insufficient Privilege."}
# 8 {"$s Unknown failure."}
# 9 {"$s Path Not Found."}
# 21 {"$s Invalid Parameter."}
Powershell: list servers that respond
#
# Create list of all servers with machine accounts in AD that respond to PING
#
##################################################################################
# Create $list of AD machine accounts for Windows Servers
$ServerList = ".\SERVERLIST.TXT"
New-Item $ServerList -Type file -Force >$nul
"Gathering Server List..."
$strCategory = "computer"
$strOS = "Windows*Server*"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = ("OperatingSystem=$strOS")
$colProplist = "dnshostname"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults) {
$objComputer = $objResult.Properties;
$Server = $objComputer.dnshostname
$Server = $Server -replace "\s{2,}", ""
$Server = $Server -replace "\.usa\.domain\.com", ""
if ($Server) {#skip null value
$Server
if (Test-Connection -ComputerName $Server -quiet -count 1) {#ping test
write-output $Server | out-file -encoding ASCII -filepath $ServerList -append
" .....OK"
}#if
}#if
}#foreach
Powershell: does reg key exist?
if (get-itemproperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate PingId -ErrorAction SilentlyContinue) { "True" } else { "False" }
Check services on all servers
#
# SVC-AUTO.PS1
# For all servers, find services with Automatic Startup that are not running
# Ignore SysMonLog("Performance Monitor Logs and Alerts")
#
##########################################################################################
#$startflag = $true
$startflag = $false
$inputfile = ".\dc-list.txt"
$names = Get-Content list.txt
$today = get-date
write "==========================================================================="
write " $today"
write " Automatic Service Status"
foreach($name in $names) {
write "---------------------------------------------------------------------------"
write-host " $name"
$svc = Get-WmiObject Win32_Service -ComputerName $name -erroraction SilentlyContinue
if ($svc) { #not null
foreach ($service in $svc) {
$svcname = $service.name
$svcdisplay = $service.displayname
$svcmode = $service.startMode
$svcstate = $service.state
if ($svcname -ne "SysMonLog") {
if ($svcmode -eq "Auto") {
if ($svcstate -eq "Stopped"){
write-host " $svcdisplay = DOWN"
if ($startflag) { #start it up
write-host " starting $svcdisplay"
$service.StartService() >$nul
sleep(10)
$svc = Get-WmiObject Win32_Service -ComputerName $name -Filter "name='$svcname'"
write-host " " $svcdisplay "..." $($svc.State)
} #if start flag
} #if stopped
}#if Auto
}#if
}#foreach service
}#if not null
else { write-host " ERROR: $name - No Response" }
}#foreach server
write "==========================================================================="
3/28/2011
WSUS Client Troubleshooting - Getting Serious
I found several VM's that weren't deployed properly (Geez SYSPREP for petes sake!!!!!)
I'm probably just going to run the following on all 400 of them just to be sure:
psexec @list.txt -u administrator -C c:\rereg.bat
Which references the following that must be on c:\ of the machine where the above is run:
@echo off
net stop wuauserv
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v LastWaitTimeout /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v DetectionStartTime /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v NextDetectionTime /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUState /f
net start wuauserv
wuauclt /resetauthorization /detectnow