私は様々なことを行い、修正情報をチェックする以下のコードを持っています。 Windows Server 2008 SP2サーバーで試したところ、Powershell v2がインストールされていませんでした。だから、私の不動産を通過し、これを修正する代わりに(3000 + 2008 SP2サーバーがあります) - コードを変更する必要があります。Powershell v1でget-hotfixが動作しません....代替が必要
私はのWin32_QuickFixEngineeringは私が私のコードに変更すべきか、あまりにも必ず同じことを行うことはできませんが、知っている - 任意の助けを借りてください。
$computerdel = gc env:computername
$t = "C:\buildlog\$(gc env:computername).log"
#$e = Test-Path $t
rm $t -ErrorAction SilentlyContinue
#if ($e -eq $true) { rm $t }
#else { Write-Host "Shortcut does not exist." }
$Logfile = "C:\buildlog\$(gc env:computername).log"
Function LogWrite
{
Param ([string]$logstring)
Add-content $Logfile -value $logstring
}
LogWrite -----------------------------------------------------------------------------------------------------------------------------------------------
$computer = gc env:computername
$Date = Get-Date
$ExecutionpolicySET = Set-ExecutionPolicy Unrestricted
$OSVersion = Get-WmiObject Win32_operatingsystem
LogWrite "Script has been run on $Date - This is Servers Local Time"
LogWrite $computer
LogWrite "Server type: "
LogWrite $OSVersion.name
$onetcp = ((get-childitem c:\windows\system32\drivers\tcpip.sys).Versioninfo.ProductMajorPart).tostring()
$twotcp = ((get-childitem c:\windows\system32\drivers\tcpip.sys).Versioninfo.ProductMinorPart).tostring()
$threetcp = ((get-childitem c:\windows\system32\drivers\tcpip.sys).Versioninfo.ProductBuildPart).tostring()
$fourtcp = ((get-childitem c:\windows\system32\drivers\tcpip.sys).Versioninfo.ProductPrivatePart).tostring()
$onedfsr = ((get-childitem c:\windows\system32\dfsrs.exe).Versioninfo.ProductMajorPart).tostring()
$twodfsr = ((get-childitem c:\windows\system32\dfsrs.exe).Versioninfo.ProductMinorPart).tostring()
$threedfsr = ((get-childitem c:\windows\system32\dfsrs.exe).Versioninfo.ProductBuildPart).tostring()
$fourdfsr = ((get-childitem c:\windows\system32\dfsrs.exe).Versioninfo.ProductPrivatePart).tostring()
$hotfix1 = Get-HotFix -Id KB2450944 -ErrorAction SilentlyContinue
$hotfix2 = Get-HotFix -Id KB2582284 -ErrorAction SilentlyContinue
$hotfix3 = Get-HotFix -Id KB979808 -ErrorAction SilentlyContinue
$hotfix4 = Get-HotFix -Id KB2121690 -ErrorAction SilentlyContinue
$hotfix5 = Get-HotFix -Id KB973776 -ErrorAction SilentlyContinue
$hotfix6 = Get-HotFix -Id KB953325 -ErrorAction SilentlyContinue
$hotfix7 = Get-HotFix -Id KB977357 -ErrorAction SilentlyContinue
$hotfix8 = Get-HotFix -Id KB2505348 -ErrorAction SilentlyContinue
$hotfix9 = Get-HotFix -Id KB2285835 -ErrorAction SilentlyContinue
$hotfix10 = Get-HotFix -Id KB976655 -ErrorAction SilentlyContinue
$hotfix11 = Get-HotFix -Id KB979564 -ErrorAction SilentlyContinue
$hotfix12 = Get-HotFix -Id KB962969 -ErrorAction SilentlyContinue
LogWrite
If ($hotfix1) {
LogWrite "Hotfix KB2450944 is installed - This is DFSRS.exe Upgrade Hotfix" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB2450944 is NOT installed - Please ensure you install this hotfix - This is DFSRS.exe Upgrade Hotfix" -ForegroundColor "red"
}
LogWrite "DFSRS.exe Version on $computer is: ""$onedfsr.$twodfsr.$threedfsr.$fourdfsr"" "
LogWrite
If ($hotfix4) {
LogWrite "Hotfix KB2121690 is installed - This is 20 CPU Patch" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB2121690 is NOT installed - This is 20 CPU Patch" -ForegroundColor "red"
}
LogWrite
If ($OSVersion.version -eq "6.0.6002")
{
If ($hotfix5) {
LogWrite "Hotfix KB973776 is installed - This is Robocopy Upgrade Hotfix" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB973776 is NOT installed - This is Robocopy Upgrade Hotfix" -ForegroundColor "red"
}
If ($hotfix6) {
LogWrite "Hotfix KB953325 is installed - Resolves Paged Pool Exhusion Issue" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB953325 is NOT installed - Resolves Paged Pool Exhusion Issue" -ForegroundColor "red"
}
If ($hotfix12) {
LogWrite "Hotfix KB962969 is installed - Resolves Command Line error on DFSRadmin.exe" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB962969 is NOT installed - Resolves Command Line error on DFSRadmin.exe" -ForegroundColor "red"
}
}
ElseIf ($OSVersion.version -eq "6.1.7600")
{
If ($hotfix2) {
LogWrite "Hotfix KB2582284 is installed - This is TCPIP.sys Upgrade Hotfix" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB2582284 is NOT installed - Please ensure you install this hotfix - This is DFSRS.exe Upgrade Hotfix" -ForegroundColor "red"
}
LogWrite "TCPIP.sys Version on $computer is: ""$onetcp.$twotcp.$threetcp.$fourtcp"" "
LogWrite
If ($hotfix3) {
LogWrite "Hotfix KB979808 is installed - This is Robocopy R2 Pre-Seeding Upgrade" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB979808 is NOT installed - This is Robocopy R2 Pre-Seeding Upgrade" -ForegroundColor "red"
}
LogWrite
If ($hotfix7) {
LogWrite "Hotfix KB977357 is installed - Resolves Memory Leak on WMI" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB977357 is NOT installed - Resolves Memory Leak on WMI" -ForegroundColor "red"
}
LogWrite
If ($hotfix8) {
LogWrite "Hotfix KB2505348 is installed - Resolves Performance issues on WMI" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB2505348 is NOT installed - Resolves Performance issues on WMI" -ForegroundColor "red"
}
LogWrite
If ($hotfix10) {
LogWrite "Hotfix KB976655 is installed - Update for dfsro.dll" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB976655 is NOT installed - Update for dfsro.dll" -ForegroundColor "red"
}
LogWrite
If ($hotfix11) {
LogWrite "Hotfix KB979564 is installed - Dfsrclus.dll update" -BackgroundColor Green -ForegroundColor Black
}
else {
LogWrite "Hotfix KB979564 is NOT installed - Dfsrclus.dll update" -ForegroundColor "red"
}
LogWrite -----------------------------------------------------------------------------------------------------------------------------------------------
fantastic!素晴らしい - 完璧に働いた。ありがとう! – lara400