扫描子网以查找未安装的应用程序

时间:2017-02-27 19:41:57

标签: powershell vbscript

我一直在努力想出一个脚本来扫描特定的子网,查找尚未安装的应用程序。我需要看看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很好,任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我前段时间写了一篇文章,它提供了一个连接到远程计算机并检索已安装应用程序的脚本:

Windows IT Pro: Auditing 32-Bit and 64-Bit Applications with PowerShell

相关问题