2017-02-27 66 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很好,任何帮助将不胜感激。

回答