2017-02-27 39 views
0

我一直在想出一個腳本來掃描尚未安裝的應用程序的特定子網。在下個月啓用網站之前,我需要查看是否在某些遠程子網上安裝了Lync。掃描未安裝的應用程序的子網

我一直在將它作爲登錄腳本運行,但它不告訴我它們在哪個子網中,並且由於用戶不註銷而填充速度不夠快。

On Error Resume Next 
Set objShell = CreateObject("WScript.Shell") 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
set objSysInfo = CreateObject("ADSystemInfo") 
Set objNetwork = WScript.CreateObject("WScript.Network") 

strValue = objShell.RegRead("HKCU\Software\MRC Custom\Skype_Audit") 
If strValue <> "Gathered 1.0" Then 
    objShell.RegWrite "HKCU\Software\MRC Custom\Skype_Audit", "Gathered 1.0" 

    x86 = objShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") 
    skypePath = x86 & "\Microsoft Office\Office15\lync.exe" 

    If objFSO.FileExists(skypePath) Then 
     version = objFSO.GetFileVersion(skypePath) 
    Else 
     version = "not installed" 
    End If 

    'Bind to the users DN 
    strUserPath = "LDAP://" & objSysInfo.UserName 
    set objUser = GetObject(strUserPath) 

    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 

    'Write Data to Log File 
    Const ForAppending = 8 
    strPath = "\\mcjunkinredman\data\userpub\Skype_Audit\Log.txt" 
    Set objTextFile = objFSO.OpenTextFile(strPath, ForAppending, True) 
    objTextFile.WriteLine objUser.samAccountName & "|" & objNetwork.ComputerName & "|" & version 
End If 

VBScript或PowerShell很好,任何幫助將不勝感激。

回答