내 워크 스테이션에서 abcultultly 잘 작동하는 VBscript가 있습니다. SCCM을 쿼리하여 컴퓨터가있는 도메인을 찾습니다. 작업 시퀀스의 일부로 실행하면 SCCM이 실패합니다. 이것은 Windows PE가 아닌 Windows 7에서 작업 순서의 마지막 단계입니다. 내가 명령 (윈도우 7이 아닌 윈도우 PE에서 F8을 사용) 작업 시퀀스를 후회하고 신속하고 스크립트를 실행을 열면작업 시퀀스에서 SCCM 쿼리 - 가능합니까?
Option Explicit
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim computerName, userName, userPassword, server
Dim swbemLocator, swbemServices, providerLoc
Dim location, connection
Dim query, found, resource, resources
'--- Settings ---
userName = "domain\username"
userPassword = "password"
server = "domain.com"
'--- Get computer name ---
computerName = CreateObject("WScript.Network").ComputerName
WScript.Echo"Computer name: " & computerName
'--- Connect ----
Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")
swbemLocator.Security_.AuthenticationLevel = 6
Set swbemServices = swbemLocator.ConnectServer(server, "root\sms",userName,userPassword)
Set providerLoc = swbemServices.InstancesOf("SMS_ProviderLocation")
For Each location In providerLoc
If location.ProviderForLocalSite = True Then
WScript.Echo "SiteCode: " & location.SiteCode
Set connection = swbemLocator.ConnectServer(server, "root\sms\site_" + location.SiteCode)
Else
WScript.Echo "Not provider for local site."
End If
Next
'--- Query & output ---
query = "SELECT * FROM SMS_FullCollectionMembership WHERE name = '" & computerName & "'"
Set resources = connection.ExecQuery(query, , wbemFlagForwardOnly Or wbemFlagReturnImmediately)
found = False
For Each resource In resources
WScript.Echo "Domain: " & resource.Domain & " (" & resource.CollectionID & ")"
found = True
Exit For
Next
If Not found Then WScript.Echo "Computer not found!"
, 내가 얻을 :
SWbemLocator은 : 액세스가 거부되었습니다
Set connection = swbemLocator.ConnectServer(server, "root\sms\site_" + location.SiteCode)
어떤 생각 : 라인에
? 컴퓨터가 지난 번에 만들어 졌던 도메인을 확인하는 방법에 대한 다른 제안이 있습니까?