这两个问题似乎有关。我已经搜索过,但似乎找不到解决这个特殊问题的方法。
我的机器启动脚本通过GPO看起来像这样(VBS)
private sub updateWSUS
on error resume next
dim strHKEY
dim wshShell
set wshShell = WScript.CreateObject( "WScript.Shell" )
strHost = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
strHostname = strHost
strHost = left(strHost, 9)
strHost = right(strHost, 3)
strHost = ucase(strHost)
select case strHost
case "PLC"
strWSUS = "SAMPLEWSUS01"
case else
strWSUS = "SAMPLEWSUS01"
end select
strWSUS = "http://" & strWSUS & ".fqdn.domain.com"
strHKEY = "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate"
wshShell.RegWrite strHKEY & "\WUServer", strWSUS, "REG_SZ"
wshShell.RegWrite strHKEY & "\WUStatusServer", strWSUS, "REG_SZ"
strRegRead = wshShell.RegRead("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\WUServer")
end sub
private sub writeResult
on error resume next
dim strFile, strHTML
dim objFSO, objFile
strFile = "c:\wsusreport.htm"
' write the error file in HTML format for easy access
strHTML = strHTML & "<html>" & vbCrLf
strHTML = strHTML & "<table><tr><td>Hostname</td><td>" & strHostname & "</td></tr>" & vbCrLf
strHTML = strHTML & "<tr><td>strHost</td><td>" & strHost & "</td></tr>" & vbCrLf
strHTML = strHTML & "<tr><td>strWSUS</td><td>" & strWSUS & "</td></tr>" & vbCrLf
strHTML = strHTML & "<tr><td>RegRead</td><td>" & strRegRead & "</td></tr>" & vbCrLf
strHTML = strHTML & "</table>" & vbCrLf
strHTML = strHTML & "<html>" & vbCrLf
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.CreateTextFile(strFile, true)
objFile.Write strHTML
objFile.Close
end sub
' BEGIN MAIN SCRIPT
dim strRegRead, strHost, strHostname, strWSUS
' write updates
updateWSUS
' write log file if possible
writeResult
Wscript.quit
我不明白为什么文件没有被写入。看起来很正确。有任何想法吗?我的用户登录脚本遇到了类似的问题。我也试过“c:\ wsusreport.htm”(两个人)无济于事。 SYSTEM具有对根驱动器的写权限。
感谢。