Skip to content

Instantly share code, notes, and snippets.

@r-plus
Last active August 29, 2015 14:16
Show Gist options
  • Save r-plus/7b4bed64f89b7a5247ef to your computer and use it in GitHub Desktop.
Save r-plus/7b4bed64f89b7a5247ef to your computer and use it in GitHub Desktop.
Get general settings of Windows for individual test.
# This script required administrator permission.
# Disk, Partition and Firewall getting cmdlet require 2012 or later.
$LOG = "C:\$(hostname)_OS_Test_$((Get-Date -Format d).Replace('/','')).log"
function EchoTitle($title)
{
echo ""
echo "******************** ${title} ********************"
echo ""
}
function EchoSubTitle($title)
{
echo ""
echo "==================== ${title}"
echo ""
}
$script = {
### get systeminformation
EchoTitle("SYSTEM INFORMATION")
systeminfo
### IP Address and DNS
EchoTitle("IP ADDRESS")
ipconfig /all
### Teaming (Available 2012 or later(NetLbfo module))
EchoTitle("NIC TEAMING")
EchoSubTitle("Team")
Get-NetLbfoTeam
EchoSubTitle("Member")
Get-NetLbfoTeamMember
EchoSubTitle("Nic")
Get-NetLbfoTeamNic
### Routing
EchoTitle("ROUTE")
route print
### Disk and Partition (Available 2012 or later(Storage module))
EchoTitle("DISK AND PARTITION")
EchoSubTitle("Disk")
Get-Disk
EchoSubTitle("Partition")
Get-Partition
### BSOD Memory Dump.
#### 0x0 : No dump
#### 0x1 : Complete memory dump
#### 0x2 : Kernel memory dump
#### 0x3 : Small memory dump
#### 0x7 : Automatic memory dump(Available after 2012)
EchoTitle("MEMORY DUMP")
$Memory_Dump="HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl"
Get-ItemProperty $Memory_Dump -name CrashDumpEnabled
### Page file
EchoTitle("PAGE FILE")
$Page_File="HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
Get-ItemProperty $Page_File -Name PagingFiles
### RDP (nothing cmd-let)
EchoTitle("RDP")
#(Get-WmiObject win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).AllowTSConnections
$RDP_Enabled="HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\"
Get-ItemProperty $RDP_Enabled -Name fDenyTSConnections
##### RDP Network Auth requirement
$RDP_Auth="HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\"
Get-ItemProperty $RDP_Auth -Name UserAuthentication
### IE ESC
EchoTitle("IE ESC")
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Get-ItemProperty $AdminKey -Name IsInstalled
Get-ItemProperty $UserKey -Name IsInstalled
### Windows Update Policy
#### 0x2 : Notify download and install.
#### 0x3 : Automatically download then notify install.
#### 0x4 : Automatically download then specific date/time install.
EchoTitle("WINDOWS UPDATE")
$WindowsUpdatePolicy="HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
Get-ItemProperty $WindowsUpdatePolicy -Name AUOptions
#### WSUS
$WSUS="HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
Get-ItemProperty $WSUS -Name WUServer
Get-ItemProperty $WSUS -Name WUStatusServer
### UAC
EchoTitle("UAC")
$UAC = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system"
Get-ItemProperty $UAC -Name ConsentPromptBehaviorAdmin
Get-ItemProperty $UAC -Name PromptOnSecureDesktop
Get-ItemProperty $UAC -Name EnableLUA
### Firewall (Available 2012 or later(NetSecurity module))
EchoTitle("WINDOWS FIREWALL")
EchoSubTitle("Firewall Profile")
Get-NetFirewallProfile
foreach ($Rule in @("InterSafe", "LogDirector", "ファイルとプリンターの共有 (エコー要求 - ICMPv4 受信)")) {
EchoSubTitle("Firewall Rule: " + $Rule)
$FWRule = Get-NetFirewallRule -DisplayName $Rule
$FWRule
$FWFilter = Get-NetFirewallApplicationFilter -AssociatedNetFirewallRule $FWRule
$FWFilter
$FWPort = Get-NetFirewallPortFilter -AssociatedNetFirewallRule $FWRule
$FWPort
}
### Time zone
EchoTitle("LOCALE")
tzutil /g
### NTP
EchoTitle("NTP(WINDOWS TIME)")
w32tm /query /peers /verbose
### Service
EchoTitle("SERVICES")
Get-WmiObject win32_service | Select name, startmode, description | Format-Table
### Windows feature, role
EchoTitle("WINDOWS FEATURE")
Get-WindowsFeature
### hosts
EchoTitle("HOSTS")
type C:\Windows\system32\drivers\etc\hosts
}
$script.Invoke() > $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment