问题描述
我做了一个配置项目,检查所有工作站的当前内部版本号。发现脚本有效,但补救脚本无效。当您将脚本从SCCM部署到设备或集合时,脚本可以工作。补救措施是否可能因为尝试将其作为非提升运行而无法正常工作? CI Properties and Remediation Deployment configured to allow Remediation to noncompliance.
-PowerShell发现脚本:
$value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuildNumber
if ($value -le 18363) {
return $true
}
-PowerShell修复脚本:
Set-Location C:
function installPrerequisites{
# Set PowerShell gallery as Trusted to bypass prompts
If(!("NuGet" -in (get-packageprovider).Name)){Install-PackageProvider -Name Nuget -Force -Confirm:$False -@R_662_4045@ionAction SilentlyContinue}
#If(!("PSgallery" -in (get-psrepository).Name)){Set-PSRepository -Name 'PSgallery' -InstallationPolicy Trusted -@R_662_4045@ionAction SilentlyContinue -WarningAction SilentlyContinue}
# Include the PowerShell Windows Update module
$checkModule=Get-Module -ListAvailable -Name PSWindowsUpdate
if(!($checkModule)){
Install-Module PSWindowsUpdate -Force -Confirm:$false;
Import-Module PSWindowsUpdate -Force;
}
}
installPrerequisites
$hostname= & hostname
Get-WindowsUpdate -AcceptAll -Install -MicrosoftUpdate -Verbose -ForceDownload -IgnoreReboot | out-file "C:\$hostname-Get.log" -force
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)