https://docs.microsoft.com/ja-jp/teamblog/technet-gallery-retirement
"We plan to retire the Gallery in June 2020, and will update this blog post with a exact date once available."最近のやつをこのページにアーカイブ...
Get Windows Update Settings from Windows 10 registry(Windows Update の設定を確認するスクリプト)https://gallery.technet.microsoft.com/scriptcenter/Get-Windows-Update-bed521e1
[get-wusettings.ps1]
※ ターゲット機能更新プログラムのバージョンのサポートとバグ修正(2020/06/29)
Write-Host ""
$WUSettingsNoAutoUpdate = ""
$WUSettingsNoAutoUpdate = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).NoAutoUpdate
$WUSettingsAUOptions = ""
$WUSettingsAUOptions = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).AUOptions
$WSUSSetting = ""
$WSUSSetting = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).UseWUServer
$WSUSSettingWUServer = ""
$WSUSSettingWUServer = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).WUServer
$WUfBSettingBranchLocal = ""
$WUfBSettingFULocal = ""
$WUfBSettingQULocal = ""
$WUfBSettingBranchLocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingBranch = ""
$WUfBSettingFU = ""
$WUfBSettingQU = ""
$WUfBSettingFUdays = ""
$WUfBSettingQUdays = ""
$WUfBSettingBranch = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdates
$WUfBSettingQU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdates
$WUfBSettingFUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingTargetReleaseVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersion
$WUfBSettingTargetReleaseVersionInfo = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersionInfo
$ConfigMgrClient = ""
$ConfigMgrClient = (Get-WmiObject -Query "Select * from __Namespace WHERE Name='CCM'" -Namespace root -ErrorAction SilentlyContinue)
if ($WSUSSetting -eq "1") {
$EffectiveWSUS = "enabled"
} else {
$EffectiveWSUS = "disabled"
}
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0))) {
$EffectiveWUfBLocal = "disabled"
} else {
$EffectiveWUfBLocal = "enabled"
}
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1")) {
$EffectiveWUfBPolicy = "enabled"
} else {
$EffectiveWUfBPolicy = "disabled"
}
if (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = "* this setting has no effect. "
$EffectiveWUfBPolicy = "* WSUS and WUfB settings are mixed. This state is not recommended. "
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "disabled")) {
$EffectiveWSUS = "* This setting is effective. "
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = "* WSUS and WUfB settings are mixed. This state is not recommended. "
} elseif (($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = "* this setting has no effect. "
$EffectiveWUfBPolicy = "* This setting is effective. "
} else {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
}
# Check WU Settings
if ($WUSettingsNoAutoUpdate.Length -eq 0) {
Write-Host "Windows Update (Policies): Not Configured (Windows 10 default is automatic)"
} else {
if ($WUSettingsNoAutoUpdate -eq "1") {
Write-Host "Windows Update (Policies): Manual (Disabled)"
} elseif ($WUSettingsAuOptions -eq "3") {
Write-Host "Windows Update (Policies): Download only"
} elseif ($WUSettingsAuOptions -eq "4") {
Write-Host "Windows Update (Policies): Automatic"
} else {
Write-Host "Windows Update (Policies): Custom"
}
Write-Host " (This setting is in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Configure Automatic Updates. )"
}
Write-Host ""
# Check WSUS Settings
if ($WSUSSetting.Length -eq 0) {
Write-Host "WSUS Client: Not Configured"
} else {
if ($WSUSSetting -eq "0") {
Write-Host "WSUS Client: Disabled"
} else {
Write-Host "WSUS Client: Enabled"
Write-Host " WSUS Server:" $WSUSSettingWUServer
}
Write-Host " ("$EffectiveWSUS"This setting is in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Specify intranet Microsoft update service location.)"
}
Write-Host ""
# Check Local WUfB Settings
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0") -and ($WUfBSettingBranchLocal -eq "16")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0)) -or ($WUfBSettingBranchLocal.Length -eq 0)) {
Write-Host "Windows Update for Business (Settings app): Not Configured"
} else {
Write-Host "Windows Update for Business (Settings app): Enabled"
if ($WUfBSettingBranchLocal -eq "16") {
Write-Host " Update Channel: Semi-Annual Channel (SAC)"
} elseif ($WUfBSettingBranchLocal -eq "32") {
Write-Host " Update Channel: SAC-T (for 1809 and below only)"
} else {
Write-Host " Update Channel: Preview Build"
}
Write-Host " After a feature update is released, defer receiving it for this days (ver 1909 or before):" $WUfBSettingFULocal
Write-Host " After a quality update is released, defer receiving it for this days (ver 1909 or before):" $WUfBSettingQULocal
Write-Host " ("$EffectiveWUfBLocal"These settings are in Settings > Update & Security > Windows Update > Advanced Options > Chose when updates are installed. (Hidden in WSUS client))"
}
Write-Host ""
# Check WUfB Settings Policies
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1") -or ($WUfBSettingTargetReleaseVersion -eq "1")) {
Write-Host "Windows Update for Business (Policies): Enabled"
if ($WUfBSettingBranch.Length -eq 0) {
Write-Host " Update Channel: Not Confiured"
} else {
if ($WUfBSettingBranch -eq "16") {
Write-Host " Update Channel: Semi-Annual Channel (SAC)"
} elseif ($WUfBSettingBranch -eq "32") {
Write-Host " Update Channel: SAC-T (for 1809 and below only)"
} else {
Write-Host " Update Channel: Preview Build"
}
}
if ($WUfBSettingFU.Length -eq 0){
Write-Host " After a feature update is released, defer receiving it for this days: Not Confugired"
} else {
Write-Host " After a feature update is released, defer receiving it for this days:" $WUfBSettingFUdays
}
if ($WUfBSettingQU.Length -eq 0){
Write-Host " After a quality update is released, defer receiving it for this days: Not Configured"
} else {
Write-Host " After a quality update is released, defer receiving it for this days:" $WUfBSettingQUdays
}
if ($WUfBSettingTargetReleaseVersionInfo.Length -eq 0){
Write-Host " Targeted feature update version (ver 1803 or later): Not Configured" $WUfBSettingTargetReleaseVersionInfo
} else {
Write-Host " Targeted feature update version (ver 1803 or later): " $WUfBSettingTargetReleaseVersionInfo
}
Write-Host " ("$EffectiveWUfBPolicy"These settings are in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Windows Update for Business.)"
} else {
Write-Host "Windows Update for Business (Policies): Not Configured"
}
Write-Host ""
# Check ConfigMgr Client
if (($ConfigMgrClient.Length -ne 0) -and (Test-Path "C:\Windows\CCMSETUP")) {
Write-Host "***************************************************************************"
Write-Host "* This device may be managed by Microsoft Endpoint Configuration Manager. *"
Write-Host "***************************************************************************"
}
Write-Host ""
$WinVer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$WinBuild = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
$WinRev = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR
Write-Host "Current update status: version"$WinVer", build" $WinBuild"."$WinRev
Write-Host ""
Write-Host "Note 1: This script does not support the identification of devices managed by Microsoft Intune or other update tools."
if ($WinVer.Substring(0,1) -eq "2") {
Write-Host "Note 2: The deferral option for Windows Update for Business (Settings app) is Discontinued in Windows 10 ver 2004."
}
Write-Host ""
[get-wusettingsj.ps1]$WUSettingsNoAutoUpdate = ""
$WUSettingsNoAutoUpdate = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).NoAutoUpdate
$WUSettingsAUOptions = ""
$WUSettingsAUOptions = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).AUOptions
$WSUSSetting = ""
$WSUSSetting = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).UseWUServer
$WSUSSettingWUServer = ""
$WSUSSettingWUServer = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).WUServer
$WUfBSettingBranchLocal = ""
$WUfBSettingFULocal = ""
$WUfBSettingQULocal = ""
$WUfBSettingBranchLocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingBranch = ""
$WUfBSettingFU = ""
$WUfBSettingQU = ""
$WUfBSettingFUdays = ""
$WUfBSettingQUdays = ""
$WUfBSettingBranch = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdates
$WUfBSettingQU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdates
$WUfBSettingFUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingTargetReleaseVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersion
$WUfBSettingTargetReleaseVersionInfo = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersionInfo
$ConfigMgrClient = ""
$ConfigMgrClient = (Get-WmiObject -Query "Select * from __Namespace WHERE Name='CCM'" -Namespace root -ErrorAction SilentlyContinue)
if ($WSUSSetting -eq "1") {
$EffectiveWSUS = "enabled"
} else {
$EffectiveWSUS = "disabled"
}
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0))) {
$EffectiveWUfBLocal = "disabled"
} else {
$EffectiveWUfBLocal = "enabled"
}
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1")) {
$EffectiveWUfBPolicy = "enabled"
} else {
$EffectiveWUfBPolicy = "disabled"
}
if (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = "* this setting has no effect. "
$EffectiveWUfBPolicy = "* WSUS and WUfB settings are mixed. This state is not recommended. "
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "disabled")) {
$EffectiveWSUS = "* This setting is effective. "
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS and WUfB settings are mixed. This state is not recommended. "
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = "* WSUS and WUfB settings are mixed. This state is not recommended. "
} elseif (($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = "* this setting has no effect. "
$EffectiveWUfBPolicy = "* This setting is effective. "
} else {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
}
# Check WU Settings
if ($WUSettingsNoAutoUpdate.Length -eq 0) {
Write-Host "Windows Update (Policies): Not Configured (Windows 10 default is automatic)"
} else {
if ($WUSettingsNoAutoUpdate -eq "1") {
Write-Host "Windows Update (Policies): Manual (Disabled)"
} elseif ($WUSettingsAuOptions -eq "3") {
Write-Host "Windows Update (Policies): Download only"
} elseif ($WUSettingsAuOptions -eq "4") {
Write-Host "Windows Update (Policies): Automatic"
} else {
Write-Host "Windows Update (Policies): Custom"
}
Write-Host " (This setting is in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Configure Automatic Updates. )"
}
Write-Host ""
# Check WSUS Settings
if ($WSUSSetting.Length -eq 0) {
Write-Host "WSUS Client: Not Configured"
} else {
if ($WSUSSetting -eq "0") {
Write-Host "WSUS Client: Disabled"
} else {
Write-Host "WSUS Client: Enabled"
Write-Host " WSUS Server:" $WSUSSettingWUServer
}
Write-Host " ("$EffectiveWSUS"This setting is in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Specify intranet Microsoft update service location.)"
}
Write-Host ""
# Check Local WUfB Settings
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0") -and ($WUfBSettingBranchLocal -eq "16")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0)) -or ($WUfBSettingBranchLocal.Length -eq 0)) {
Write-Host "Windows Update for Business (Settings app): Not Configured"
} else {
Write-Host "Windows Update for Business (Settings app): Enabled"
if ($WUfBSettingBranchLocal -eq "16") {
Write-Host " Update Channel: Semi-Annual Channel (SAC)"
} elseif ($WUfBSettingBranchLocal -eq "32") {
Write-Host " Update Channel: SAC-T (for 1809 and below only)"
} else {
Write-Host " Update Channel: Preview Build"
}
Write-Host " After a feature update is released, defer receiving it for this days (ver 1909 or before):" $WUfBSettingFULocal
Write-Host " After a quality update is released, defer receiving it for this days (ver 1909 or before):" $WUfBSettingQULocal
Write-Host " ("$EffectiveWUfBLocal"These settings are in Settings > Update & Security > Windows Update > Advanced Options > Chose when updates are installed. (Hidden in WSUS client))"
}
Write-Host ""
# Check WUfB Settings Policies
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1") -or ($WUfBSettingTargetReleaseVersion -eq "1")) {
Write-Host "Windows Update for Business (Policies): Enabled"
if ($WUfBSettingBranch.Length -eq 0) {
Write-Host " Update Channel: Not Confiured"
} else {
if ($WUfBSettingBranch -eq "16") {
Write-Host " Update Channel: Semi-Annual Channel (SAC)"
} elseif ($WUfBSettingBranch -eq "32") {
Write-Host " Update Channel: SAC-T (for 1809 and below only)"
} else {
Write-Host " Update Channel: Preview Build"
}
}
if ($WUfBSettingFU.Length -eq 0){
Write-Host " After a feature update is released, defer receiving it for this days: Not Confugired"
} else {
Write-Host " After a feature update is released, defer receiving it for this days:" $WUfBSettingFUdays
}
if ($WUfBSettingQU.Length -eq 0){
Write-Host " After a quality update is released, defer receiving it for this days: Not Configured"
} else {
Write-Host " After a quality update is released, defer receiving it for this days:" $WUfBSettingQUdays
}
if ($WUfBSettingTargetReleaseVersionInfo.Length -eq 0){
Write-Host " Targeted feature update version (ver 1803 or later): Not Configured" $WUfBSettingTargetReleaseVersionInfo
} else {
Write-Host " Targeted feature update version (ver 1803 or later): " $WUfBSettingTargetReleaseVersionInfo
}
Write-Host " ("$EffectiveWUfBPolicy"These settings are in Computer Configuration\Adminisrative Template\Windows Component\Windows Update\Windows Update for Business.)"
} else {
Write-Host "Windows Update for Business (Policies): Not Configured"
}
Write-Host ""
# Check ConfigMgr Client
if (($ConfigMgrClient.Length -ne 0) -and (Test-Path "C:\Windows\CCMSETUP")) {
Write-Host "***************************************************************************"
Write-Host "* This device may be managed by Microsoft Endpoint Configuration Manager. *"
Write-Host "***************************************************************************"
}
Write-Host ""
$WinVer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$WinBuild = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
$WinRev = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR
Write-Host "Current update status: version"$WinVer", build" $WinBuild"."$WinRev
Write-Host ""
Write-Host "Note 1: This script does not support the identification of devices managed by Microsoft Intune or other update tools."
if ($WinVer.Substring(0,1) -eq "2") {
Write-Host "Note 2: The deferral option for Windows Update for Business (Settings app) is Discontinued in Windows 10 ver 2004."
}
Write-Host ""
※ ターゲット機能更新プログラムのバージョンのサポートとバグ修正(2020/06/29)
Write-Host ""
$WUSettingsNoAutoUpdate = ""
$WUSettingsNoAutoUpdate = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).NoAutoUpdate
$WUSettingsAUOptions = ""
$WUSettingsAUOptions = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).AUOptions
$WSUSSetting = ""
$WSUSSetting = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).UseWUServer
$WSUSSettingWUServer = ""
$WSUSSettingWUServer = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).WUServer
$WUfBSettingBranchLocal = ""
$WUfBSettingFULocal = ""
$WUfBSettingQULocal = ""
$WUfBSettingBranchLocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingBranch = ""
$WUfBSettingFU = ""
$WUfBSettingQU = ""
$WUfBSettingFUdays = ""
$WUfBSettingQUdays = ""
$WUfBSettingBranch = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdates
$WUfBSettingQU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdates
$WUfBSettingFUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingTargetReleaseVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersion
$WUfBSettingTargetReleaseVersionInfo = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersionInfo
$ConfigMgrClient = ""
$ConfigMgrClient = (Get-WmiObject -Query "Select * from __Namespace WHERE Name='CCM'" -Namespace root -ErrorAction SilentlyContinue)
if ($WSUSSetting -eq "1") {
$EffectiveWSUS = "enabled"
} else {
$EffectiveWSUS = "disabled"
}
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0))) {
$EffectiveWUfBLocal = "disabled"
} else {
$EffectiveWUfBLocal = "enabled"
}
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1")) {
$EffectiveWUfBPolicy = "enabled"
} else {
$EffectiveWUfBPolicy = "disabled"
}
if (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = "* この設定は無視されます。"
$EffectiveWUfBPolicy = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled")) {
$EffectiveWSUS = "(* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "disabled")) {
$EffectiveWSUS = "* この設定が優先されます。"
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
} elseif (($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = "* この設定は無視されます。"
$EffectiveWUfBPolicy = "* この設定が優先されます。"
} else {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
}
# Check WU Settings
if ($WUSettingsNoAutoUpdate.Length -eq 0) {
Write-Host "Windows Update (ポリシー): 未構成 (Windows 10 の既定は自動)"
} else {
if ($WUSettingsNoAutoUpdate -eq "1") {
Write-Host "Windows Update (ポリシー): 手動 (無効)"
} elseif ($WUSettingsAuOptions -eq "3") {
Write-Host "Windows Update (ポリシー): ダウンロードのみ"
} elseif ($WUSettingsAuOptions -eq "4") {
Write-Host "Windows Update (ポリシー): 自動"
} else {
Write-Host "Windows Update (ポリシー): カスタム"
}
Write-Host " (設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\自動更新を構成する)"
}
Write-Host ""
# Check WSUS Settings
if ($WSUSSetting.Length -eq 0) {
Write-Host "WSUS クライアント: 未構成"
} else {
if ($WSUSSetting -eq "0") {
Write-Host "WSUS クライアント: 無効"
} else {
Write-Host "WSUS クライアント: 有効"
Write-Host " WSUS サーバー:" $WSUSSettingWUServer
}
Write-Host " ("$EffectiveWSUS"設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\イントラネットの Microsoft 更新サービスの場所を指定する)"
}
Write-Host ""
# Check Local WUfB Settings
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0") -and ($WUfBSettingBranchLocal -eq "16")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0)) -or ($WUfBSettingBranchLocal.Length -eq 0)) {
Write-Host "Windows Update for Business (設定アプリ): 未構成"
} else {
Write-Host "Windows Update for Business (設定アプリ): 有効"
if ($WUfBSettingBranchLocal -eq "16") {
Write-Host " 更新チャネル(Windows 準備レベル): 半期チャネル (SAC)"
} elseif ($WUfBSettingBranchLocal -eq "32") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC-T (1809 以前のみ)"
} else {
Write-Host " 更新チャネル(Windows 準備レベル): Preview Build"
}
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingFULocal
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingQULocal
Write-Host " ("$EffectiveWUfBLocal"設定場所:設定アプリ > 更新とセキュリティ > Windows Update > 詳細オプション > 更新プログラムをいつインストールするかを選択する(WSUS クライアントでは非表示))"
}
Write-Host ""
# Check WUfB Settings Policies
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1") -or ($WUfBSettingTargetReleaseVersion -eq "1")) {
Write-Host "Windows Update for Business (ポリシー): 有効"
if ($WUfBSettingBranch.Length -eq 0) {
Write-Host " 更新チャネル(Windows 準備レベル): 未構成"
} else {
if ($WUfBSettingBranch -eq "16") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC"
} elseif ($WUfBSettingBranch -eq "32") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC-T (1809 以前のみ)"
} else {
Write-Host " 更新チャネル(Windows 準備レベル): Preview Build"
}
}
if ($WUfBSettingFU.Length -eq 0){
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数: 未構成"
} else {
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingFUdays
}
if ($WUfBSettingQU.Length -eq 0){
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数: 未構成"
} else {
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingQUdays
}
if ($WUfBSettingTargetReleaseVersionInfo.Length -eq 0){
Write-Host " ターゲット機能更新プログラムのバージョン (1803 以降): 未構成"
} else {
Write-Host " ターゲット機能更新プログラムのバージョン (1803 以降): " $WUfBSettingTargetReleaseVersionInfo
}
Write-Host " ("$EffectiveWUfBPolicy"設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\Windows Update for Business)"
} else {
Write-Host "Windows Update for Business (ポリシー): 未構成"
}
Write-Host ""
# Check ConfigMgr Client
if (($ConfigMgrClient.Length -ne 0) -and (Test-Path "C:\Windows\CCMSETUP")) {
Write-Host "**********************************************************************************************"
Write-Host "* この PC は Microsoft Endpoint Configration Manager によって管理されている可能性があります。*"
Write-Host "**********************************************************************************************"
}
Write-Host ""
$WinVer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$WinBuild = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
$WinRev = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR
Write-Host "現在の更新状態: バージョン"$WinVer", ビルド" $WinBuild"."$WinRev
Write-Host ""
Write-Host "注意 1: このスクリプトは Microsoft Intune やその他の更新ツールで管理される PC の調査には対応していません。"
if ($WinVer.Substring(0,1) -eq "2") {
Write-Host "注意 2: Windows Update for Business (設定アプリ)の延期オプションは Windows 10 ver 2004 で廃止されました。"
}
Write-Host ""
$WUSettingsNoAutoUpdate = ""
$WUSettingsNoAutoUpdate = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).NoAutoUpdate
$WUSettingsAUOptions = ""
$WUSettingsAUOptions = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).AUOptions
$WSUSSetting = ""
$WSUSSetting = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -ErrorAction SilentlyContinue).UseWUServer
$WSUSSettingWUServer = ""
$WSUSSettingWUServer = (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).WUServer
$WUfBSettingBranchLocal = ""
$WUfBSettingFULocal = ""
$WUfBSettingQULocal = ""
$WUfBSettingBranchLocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQULocal = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingBranch = ""
$WUfBSettingFU = ""
$WUfBSettingQU = ""
$WUfBSettingFUdays = ""
$WUfBSettingQUdays = ""
$WUfBSettingBranch = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).BranchReadinessLevel
$WUfBSettingFU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdates
$WUfBSettingQU = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdates
$WUfBSettingFUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferFeatureUpdatesPeriodInDays
$WUfBSettingQUdays = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).DeferQualityUpdatesPeriodInDays
$WUfBSettingTargetReleaseVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersion
$WUfBSettingTargetReleaseVersionInfo = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ErrorAction SilentlyContinue).TargetReleaseVersionInfo
$ConfigMgrClient = ""
$ConfigMgrClient = (Get-WmiObject -Query "Select * from __Namespace WHERE Name='CCM'" -Namespace root -ErrorAction SilentlyContinue)
if ($WSUSSetting -eq "1") {
$EffectiveWSUS = "enabled"
} else {
$EffectiveWSUS = "disabled"
}
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0))) {
$EffectiveWUfBLocal = "disabled"
} else {
$EffectiveWUfBLocal = "enabled"
}
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1")) {
$EffectiveWUfBPolicy = "enabled"
} else {
$EffectiveWUfBPolicy = "disabled"
}
if (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = "* この設定は無視されます。"
$EffectiveWUfBPolicy = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBLocal -eq "enabled")) {
$EffectiveWSUS = "(* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "disabled")) {
$EffectiveWSUS = "* この設定が優先されます。"
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
} elseif (($EffectiveWSUS -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = "* WSUS と WUfB の設定が混在しています。この設定は推奨されません。"
} elseif (($EffectiveWUfBLocal -eq "enabled") -and ($EffectiveWUfBPolicy -eq "enabled")) {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = "* この設定は無視されます。"
$EffectiveWUfBPolicy = "* この設定が優先されます。"
} else {
$EffectiveWSUS = ""
$EffectiveWUfBLocal = ""
$EffectiveWUfBPolicy = ""
}
# Check WU Settings
if ($WUSettingsNoAutoUpdate.Length -eq 0) {
Write-Host "Windows Update (ポリシー): 未構成 (Windows 10 の既定は自動)"
} else {
if ($WUSettingsNoAutoUpdate -eq "1") {
Write-Host "Windows Update (ポリシー): 手動 (無効)"
} elseif ($WUSettingsAuOptions -eq "3") {
Write-Host "Windows Update (ポリシー): ダウンロードのみ"
} elseif ($WUSettingsAuOptions -eq "4") {
Write-Host "Windows Update (ポリシー): 自動"
} else {
Write-Host "Windows Update (ポリシー): カスタム"
}
Write-Host " (設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\自動更新を構成する)"
}
Write-Host ""
# Check WSUS Settings
if ($WSUSSetting.Length -eq 0) {
Write-Host "WSUS クライアント: 未構成"
} else {
if ($WSUSSetting -eq "0") {
Write-Host "WSUS クライアント: 無効"
} else {
Write-Host "WSUS クライアント: 有効"
Write-Host " WSUS サーバー:" $WSUSSettingWUServer
}
Write-Host " ("$EffectiveWSUS"設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\イントラネットの Microsoft 更新サービスの場所を指定する)"
}
Write-Host ""
# Check Local WUfB Settings
if ((($WUfBSettingFULocal -eq "0") -and ($WUfBSettingQULocal -eq "0") -and ($WUfBSettingBranchLocal -eq "16")) -or (($WUfBSettingFULocal.Length -eq 0) -and ($WUfBSettingQULocal.Length -eq 0)) -or ($WUfBSettingBranchLocal.Length -eq 0)) {
Write-Host "Windows Update for Business (設定アプリ): 未構成"
} else {
Write-Host "Windows Update for Business (設定アプリ): 有効"
if ($WUfBSettingBranchLocal -eq "16") {
Write-Host " 更新チャネル(Windows 準備レベル): 半期チャネル (SAC)"
} elseif ($WUfBSettingBranchLocal -eq "32") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC-T (1809 以前のみ)"
} else {
Write-Host " 更新チャネル(Windows 準備レベル): Preview Build"
}
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingFULocal
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingQULocal
Write-Host " ("$EffectiveWUfBLocal"設定場所:設定アプリ > 更新とセキュリティ > Windows Update > 詳細オプション > 更新プログラムをいつインストールするかを選択する(WSUS クライアントでは非表示))"
}
Write-Host ""
# Check WUfB Settings Policies
if (($WUfBSettingFU -eq "1") -or ($WUfBSettingQU -eq "1") -or ($WUfBSettingTargetReleaseVersion -eq "1")) {
Write-Host "Windows Update for Business (ポリシー): 有効"
if ($WUfBSettingBranch.Length -eq 0) {
Write-Host " 更新チャネル(Windows 準備レベル): 未構成"
} else {
if ($WUfBSettingBranch -eq "16") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC"
} elseif ($WUfBSettingBranch -eq "32") {
Write-Host " 更新チャネル(Windows 準備レベル): SAC-T (1809 以前のみ)"
} else {
Write-Host " 更新チャネル(Windows 準備レベル): Preview Build"
}
}
if ($WUfBSettingFU.Length -eq 0){
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数: 未構成"
} else {
Write-Host " 機能更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingFUdays
}
if ($WUfBSettingQU.Length -eq 0){
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数: 未構成"
} else {
Write-Host " 品質更新プログラムがリリースされた後、受信を延期する日数:" $WUfBSettingQUdays
}
if ($WUfBSettingTargetReleaseVersionInfo.Length -eq 0){
Write-Host " ターゲット機能更新プログラムのバージョン (1803 以降): 未構成"
} else {
Write-Host " ターゲット機能更新プログラムのバージョン (1803 以降): " $WUfBSettingTargetReleaseVersionInfo
}
Write-Host " ("$EffectiveWUfBPolicy"設定場所:コンピューターの構成\管理用テンプレート\Windows コンポーネント\Windows Update\Windows Update for Business)"
} else {
Write-Host "Windows Update for Business (ポリシー): 未構成"
}
Write-Host ""
# Check ConfigMgr Client
if (($ConfigMgrClient.Length -ne 0) -and (Test-Path "C:\Windows\CCMSETUP")) {
Write-Host "**********************************************************************************************"
Write-Host "* この PC は Microsoft Endpoint Configration Manager によって管理されている可能性があります。*"
Write-Host "**********************************************************************************************"
}
Write-Host ""
$WinVer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$WinBuild = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
$WinRev = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR
Write-Host "現在の更新状態: バージョン"$WinVer", ビルド" $WinBuild"."$WinRev
Write-Host ""
Write-Host "注意 1: このスクリプトは Microsoft Intune やその他の更新ツールで管理される PC の調査には対応していません。"
if ($WinVer.Substring(0,1) -eq "2") {
Write-Host "注意 2: Windows Update for Business (設定アプリ)の延期オプションは Windows 10 ver 2004 で廃止されました。"
}
Write-Host ""
Install and update SysinternalsSuite by PowerShell(Sysinternals Suite の総入れ替えスクリプト)
https://gallery.technet.microsoft.com/scriptcenter/Install-and-update-d8ffffdb
[installsysinternalssuite.ps1]
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$InstallTo = "$env:ProgramFiles\SysinternalsSuite"
if (Test-Path "$env:TEMP\SysinternalsSuite.zip") {
Remove-Item -Path "$env:TEMP\SysinternalsSuite.zip"
}
if (!(Test-Path "$InstallTo")) {
Write-Host "Start Download SysinternalsSuite.zip ..."
Invoke-WebRequest -uri "https://live.sysinternals.com/files/sysinternalssuite.zip" -outfile "$env:TEMP\sysinternalssuite.zip" -UseBasicParsing
Write-Host "Expand SysinternalsSuite.zip ..."
Expand-Archive -Path "$env:TEMP\SysinternalsSuite.zip" -DestinationPath "$InstallTo"
Write-Host "Add PATH environment variable ..."
$path = [Environment]::GetEnvironmentVariable("PATH", "Machine")
$path += ";" + "$InstallTo"
[Environment]::SetEnvironmentVariable("PATH", $path, "Machine")
$env:PATH = $path
} else {
Write-Host "Sysinternals Suite has already been installed in $InstallTo.`r`n"
Write-Host "Searching https://live.sysinternals.com/ ..."
$webcontent = (Invoke-WebRequest -uri "https://live.sysinternals.com/files/" -UseBasicParsing).Content
(((($webcontent.Replace("<br>","`r`n")).Replace("</A>","")).Replace("<A HREF=","")).Replace(">"," ")).split("`r`n")|Select-String "SysinternalsSuite.zip"
Write-Host "`r`n"
#Write-Host "Searching current latest version top 5..."
#Get-ChildItem -Path "$InstallTo\*.exe"| Sort-Object LastWriteTime -Desc |Select-Object -first 5 | Ft LastWriteTime, Name
[ValidateSet("y","n")] $res = Read-Host "Will you update SysinternalsSuite anyway (y/n) ?"
if ($res -eq "y") {
Write-Host "Start Download SysinternalsSuite.zip ..."
Invoke-WebRequest -uri "https://live.sysinternals.com/files/sysinternalssuite.zip" -outfile "$env:TEMP\sysinternalssuite.zip" -UseBasicParsing
Write-Host "Expand SysinternalsSuite.zip ..."
Expand-Archive -Path "$env:TEMP\SysinternalsSuite.zip" -DestinationPath "$InstallTo" -Force
Write-Host "SysinternalsSuite was updated to latest version."
}
}
$InstallTo = "$env:ProgramFiles\SysinternalsSuite"
if (Test-Path "$env:TEMP\SysinternalsSuite.zip") {
Remove-Item -Path "$env:TEMP\SysinternalsSuite.zip"
}
if (!(Test-Path "$InstallTo")) {
Write-Host "Start Download SysinternalsSuite.zip ..."
Invoke-WebRequest -uri "https://live.sysinternals.com/files/sysinternalssuite.zip" -outfile "$env:TEMP\sysinternalssuite.zip" -UseBasicParsing
Write-Host "Expand SysinternalsSuite.zip ..."
Expand-Archive -Path "$env:TEMP\SysinternalsSuite.zip" -DestinationPath "$InstallTo"
Write-Host "Add PATH environment variable ..."
$path = [Environment]::GetEnvironmentVariable("PATH", "Machine")
$path += ";" + "$InstallTo"
[Environment]::SetEnvironmentVariable("PATH", $path, "Machine")
$env:PATH = $path
} else {
Write-Host "Sysinternals Suite has already been installed in $InstallTo.`r`n"
Write-Host "Searching https://live.sysinternals.com/ ..."
$webcontent = (Invoke-WebRequest -uri "https://live.sysinternals.com/files/" -UseBasicParsing).Content
(((($webcontent.Replace("<br>","`r`n")).Replace("</A>","")).Replace("<A HREF=","")).Replace(">"," ")).split("`r`n")|Select-String "SysinternalsSuite.zip"
Write-Host "`r`n"
#Write-Host "Searching current latest version top 5..."
#Get-ChildItem -Path "$InstallTo\*.exe"| Sort-Object LastWriteTime -Desc |Select-Object -first 5 | Ft LastWriteTime, Name
[ValidateSet("y","n")] $res = Read-Host "Will you update SysinternalsSuite anyway (y/n) ?"
if ($res -eq "y") {
Write-Host "Start Download SysinternalsSuite.zip ..."
Invoke-WebRequest -uri "https://live.sysinternals.com/files/sysinternalssuite.zip" -outfile "$env:TEMP\sysinternalssuite.zip" -UseBasicParsing
Write-Host "Expand SysinternalsSuite.zip ..."
Expand-Archive -Path "$env:TEMP\SysinternalsSuite.zip" -DestinationPath "$InstallTo" -Force
Write-Host "SysinternalsSuite was updated to latest version."
}
}
Get version and update channel from local installed Office 365 (for 2016)(Office 365 のバージョンと更新チャネルの確認)https://gallery.technet.microsoft.com/scriptcenter/Get-version-and-update-041fd094
[get-o365ver.ps1]
$O365CurrentVer = ""
$O365CurrentCdn = ""
$O365CurrentPol = ""
$O365CurrentVer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -ErrorAction SilentlyContinue).VersionToReport
$O365CurrentCdn = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -ErrorAction SilentlyContinue).CDNBaseUrl
$O365CurrentPol = (Get-ItemProperty -Path "HKLM:\SOFTWARE\policies\microsoft\office\16.0\common\officeupdate" -ErrorAction SilentlyContinue).updatebranch
if ($O365CurrentVer.Length -eq 0) {
Write-Host "Office 365 (C2R) is not installed on this PC."
}
else
{
Write-Host "Office 365 (C2R) Current Version: "$O365CurrentVer
switch ($O365CurrentCdn) {
"http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60" {$O365CurrentCdn = "Monthly Channel"}
"http://officecdn.microsoft.com/pr/7ffbc6bf-bc32-4f92-8982-f9dd17fd3114" {$O365CurrentCdn = "Semi-Annual Channel"}
"http://officecdn.microsoft.com/pr/b8f9b850-328d-4355-9145-c59439a0c4cf" {$O365CurrentCdn = "Semi-Annual Channel (Targeted)"}
}
Write-Host "Office 365 Update Channel (Local Setting): "$O365CurrentCdn
if ($O365CurrentPol.length -eq 0) {
$O365CurrentPol = "None"
} else {
switch ($O365CurrentPol) {
"Current" {$O365CurrentPol = "Monthly Channel"}
"Deferred" {$O365CurrentPol = "Semi-Annual Channel"}
"FirstReleaseDeferred" {$O365CurrentPol = "Semi-Annual Channel (Targeted)l"}
}
}
Write-Host "Office 365 Update Channel (Policy Setting): "$O365CurrentPol
}
12/4 追記)新しい更新チャネルに対応した get-m365ver.ps1 はこちら
PowerShell script for checking HTTP (S) response(HTTP レスポンスの確認)https://gallery.technet.microsoft.com/scriptcenter/PowerShell-script-for-f8e39a90
[checkurl.ps1 <url>]
param($targeturi)
# Using TLS 1.2 only for HTTPS
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Using TLS 1.0/1.1/1.2 for HTTPS
[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls,[Net.SecurityProtocolType]::Tls11,[Net.SecurityProtocolType]::Tls12)
# Check PSVersion
if ($PSVersiontable.PSVersion.Major -lt 3) {
Write-Host "To use this script, you need Windows PowerShell 3.0 or later."
exit
}
if ($targeturi -eq $null) {
Write-Host "Usage: .\checkurl.ps1 http(s)://..."
exit
}
try {
$httpstatuscode = (Invoke-WebRequest $targeturi).StatusCode
if ($httpstatuscode -lt 400) {
Write-Host "OK:"$httpstatuscode
} else {
# This block will never be processed.
Write-Host "HTTP Error:"$httpstatuscode
}
}
catch [System.Net.WebException]
{
Write-Host "Invoke-WebRequest Error:"$error[0].Exception.Message
}
Determine which .NET Framework versions are installed by PowerShell(.NET Framework のバージョン確認)https://gallery.technet.microsoft.com/scriptcenter/Determine-which-NET-01a6a4f5
[get-dotnetver.ps1]
# Reference # How to: Determine which .NET Framework versions are installed # https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed # Lifecycle FAQ -- .NET Framework # https://support.microsoft.com/en-us/help/17455/ # version 2.2 (2019/04/19) $dotnet40 = $true Write-Host "*** .NET Framework 4.5 or later *** " if (Test-Path -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") { if (((Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version).Substring(0,4) -eq "4.0.") { Write-Host "Not installed." } else { $dotnet40 = $false switch ((Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Release) { 378389 { Write-Host ".NET Framework 4.5" } 378675 { Write-Host ".NET Framework 4.5.1 installed with Windows 8.1" } 378758 { Write-Host ".NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2" } 379893 { Write-Host ".NET Framework 4.5.2" } 393295 { Write-Host ".NET Framework 4.6 installed with Windows 10" } 393297 { Write-Host ".NET Framework 4.6 installed on all other Windows OS versions" } 394254 { Write-Host ".NET Framework 4.6.1 installed on Windows 10" } 394271 { Write-Host ".NET Framework 4.6.1 installed on all other Windows OS versions" } 394802 { Write-Host ".NET Framework 4.6.2 installed on Windows 10 Anniversary Update and Windows Server 2016" } 394806 { Write-Host ".NET Framework 4.6.2 installed on all other Windows OS versions" } 460798 { Write-Host ".NET Framework 4.7 installed on Windows 10 Creators Update" } 460805 { Write-Host ".NET Framework 4.7 installed on all other Windows OS versions" } 461308 { Write-Host ".NET Framework 4.7.1 installed on Windows 10 Fall Creators Update and Windows Server, version 1709" } 461310 { Write-Host ".NET Framework 4.7.1 installed on all other Windows OS versions" } 461808 { Write-Host ".NET Framework 4.7.2 installed on Windows 10 April 2018 Update and Windows Server, version 1803" } 461814 { Write-Host ".NET Framework 4.7.2 installed on all Windows OS versions other than Windows 10 April 2018 Update and Windows Server, version 1803" } 528040 { Write-Host ".NET Framework 4.8 installed on Windows 10 May 2019 Update and Windows Server, version 1903" } 528049 { Write-Host ".NET Framework 4.8 installed on all Windows OS versions other than Windows 10 May 2019 Update and Windows Server, version 1903" } default { Write-Host ".NET Framework 4.8 or later installed on all other Windows OS versions" } } } } else { Write-Host "Not installed." } $dotnet35 = $false Write-Host "*** .NET Framework 2-4 *** " if (Test-Path -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\") { $dotnetvers = (Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v*" -Name) foreach ($dotnetver in $dotnetvers) { if ($dotnetver.Length -ge 4) { switch ($dotnetver.Substring(0,4)) { "v2.0" { Write-Host ".NET Framework 2 ("(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\$dotnetver" -ErrorAction SilentlyContinue).Version")";$dotnet35 = $true } "v3.0" { Write-Host ".NET Framework 3.0 ("(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\$dotnetver").Version")";$dotnet35 = $true } "v3.5" { Write-Host ".NET Framework 3.5 ("(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\$dotnetver" -ErrorAction SilentlyContinue).Version")";$dotnet35 = $true } } } elseif (($dotnetver -eq "v4") -and ($dotnet40)) { Write-Host ".NET Framework 4 ( Client"(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" -ErrorAction SilentlyContinue).Version"/Full"(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version")" } } if ((!$dotnet35) -and (!$dotnet40)) { Write-Host "Not installed." } } else { Write-Host "Something went wrong." }
Show Windows Update History by PowerShell(Windows Update の履歴、Server Core での利用を想定)https://gallery.technet.microsoft.com/scriptcenter/Show-Windows-Update-c7ee69bd
[get-windowsupdateistory.ps1]
$objSession = new-object -com "Microsoft.Update.Session" $objSearcher = $objSession.CreateupdateSearcher() $intCount = $objSearcher.GetTotalHistoryCount() $colHistory = $objSearcher.QueryHistory(0, $intCount) foreach ($objHistory in $colHistory) { if ($objHistory.HResult -eq 0) { Write-Host ($objHistory.Date).ToString("yyyy/MM/dd hh:mm UTC") $objHistory.Title "- Successfully installed" } elseif ($objHistory.HResult -eq -2145116140) { Write-Host ($objHistory.Date).ToString("yyyy/MM/dd hh:mm UTC") $objHistory.Title "- Pending Reboot" } else { # Report errors for the past month if (($objHistory.Date).AddMonths(1) -gt (Get-Date)) { Write-Host ($objHistory.Date).ToString("yyyy/MM/dd hh:mm UTC") $objHistory.Title "- Failed to install (Error:"$objHistory.HResult.ToString("X8")")" } } }
Search and Install updates for Server Core by PowerShell (for RS3 or later).(更新プログラムの確認とインストール、Server Core での利用を想定)https://gallery.technet.microsoft.com/scriptcenter/Search-and-Install-updates-083cf7d6
[SeachandInstallUpdates.ps1]
Import-Module WindowsUpdateProvider -ErrorAction SilentlyContinue $checkmodule = (Get-Module WindowsUpdateProvider) if ($checkmodule -eq $null) { Write-Host "This script can be run on Windows 10/Server ver 1709(RS3) or later." exit } Write-Host "Product Name: " (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName Write-Host "OS Version: " (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId Write-Host "Current OS Build:" (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild + "." + (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR Write-Host "Last Check date: " (Get-WULastScanSuccessDate).DateTime Write-Host "Last Installation date: " (Get-WULastInstallationDate).DateTime # Search for all applicable updates Write-Host "`r`nSearching for all applicable updates..." $updates = Start-WUScan # Search for only recommended updates # Write-Host "`r`nSearching for recommended updates..." # $updates = Start-WUScan -SearchCriteria "IsInstalled=0 and Type='Software' and AutoSelectOnWebsites=1" $updatesCount = $updates.Count if ($updatesCount -gt 0) { if ($updatesCount -eq 1) { Write-Host "One update was found.`r`n" } else { Write-Host $updates.Count "updates were found.`r`n" } $i = 1 foreach ($update in $updates) { Write-Host $i")" $update.Title $i = $i + 1 } $result = $false $res = Read-Host "`r`n(A)ll updates, (N)o update or Enter the number of the update to download and install? (A/N/#) " if (($res -eq "a") -or ($res -eq "A")) { $i = 1 Write-Host "`r`nInstalling all updates...`r`n" foreach ($update in $updates) { Write-Host "Update ("$i" of "$updatesCount"):" $update.Title $result = (Install-WUUpdates -Updates $update -ErrorAction SilentlyContinue) if ($result) { Write-Host "Installation Result: Succeeded" } else { Write-Host "Installation Result: Failed with errors." } $i = $i + 1 } } elseif (($res -gt 0) -and ($res -lt ($updates.Count + 1))) { Write-Host "`r`nInstalling an update (No."$res")...`r`n" Write-Host "Update:" $updates.item($res - 1).Title $result = (Install-WUUpdates -Updates $updates.item($res - 1) -ErrorAction SilentlyContinue) if ($result) { Write-Host "Installation Result: Succeeded" } else { Write-Host "Installation Result: Failed with errors." } } else { Write-Host "Installation canceled." exit } if (Get-WUIsPendingReboot) { $res = Read-Host "A restart is required to complete Windows Updates. Restart now? (y/n) " if (($res -eq "y") -or ($res -eq "Y")) { Write-Host "Start rebooting..." Restart-Computer -Force } else { Write-Host "You need to restart later." } } } else { Write-Host "There are no applicable updates." }
ひな形(空き子、ダミー)
[dummy.ps1]
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。