Ipenable=true preference

I am using the following wmi script to insure the DNS registration checkbox is enable, in a startup script.
wmic path win32_networkadapterconfiguration where ipenabled=true call setdynamicdnsregistration 1,1
I need to somehow move this to a preference so I can apply it to everything except a specified OU.
Can you help?

> or maybe credentials; I assume since it was a computer GPP that it's
> using the system account.
No, it is using the computer account. So "domain computers" need read.
> And because its running from a Share I get the
> prompt to run. How should I do this; do I have to copy it down to 10k
> computers and run it locally?
That's the preferred way anyway: Do not access network paths unless you
MUST do so. Better create a startup script that uses robocopy to sync a
remote path to a local "cache" folder and point ALL of your other
scripts and tasks and whatever to this local folder.
> Ok, now I just manually ran it from the local Task Schedule and it
> worked, what gives, why isn't it applying on startup?
Maybe it executes before the network is available. Task scheduler event
log might be helpful...
Martin
Mal ein
GUTES Buch über GPOs lesen?
NO THEY ARE NOT EVIL, if you know what you are doing:
Good or bad GPOs?
And if IT bothers me - coke bottle design refreshment :))

Similar Messages

  • Error Level 10: I have this error where a plugin broke that I had to remove because it was not finding it. How do i install it back so it functions?

    8/29/2014 7:15am
    It seems to me that if Microsoft's platform can not fix it with the troubleshooter that the troubleshooter sucks.  It does not know when errors are thrown so your developer sucks on creating software for errors that are popping up in your software?
    if a error is thrown in Windows 8 it should catch it upon a thrown error in programming? This hsould be a level 1 ticket. Since when I call you support for error in your product no one wants to address problems in your software and get mea tech to resolve
    it?
    The question now is how do I fix this and why is it causing me an internal error 500 for my web server install?
    I may have other issues but I need access to my web server through my browser I used fsocketopen to troubleshoot it?
    It gets back a internal 500 on Gecko process in firefox and on IE it just won't serve out the document in my web server abyss or apache? So the question is what service is broken so I can't serve my [web server] pages out? Let me go through all the event
    logs that I have with errors below?
    Under Applications:
    1) Failure to load the application settings for package microsoft.windowscommunicationsapps_8wekyb3d8bbwe. Error Code: 10
    2) LMS Service cannot connect to Intel(R) MEI driver. Error level 1
    3) Failure to load the application settings for package microsoft.windowscommunicationsapps_8wekyb3d8bbwe. Error Code: 3
    4) SearchIndexer (3476) Windows: The database engine attached a database (1, C:\ProgramData\Microsoft\Search\Data\Applications\Windows\Windows.edb). (Time=0 seconds)
    5) Internal Timing Sequence: [1] 0.000, [2] 0.000, [3] 0.125, [4] 0.000, [5] 0.000, [6] 0.000, [7] 0.000, [8] 0.000, [9] 0.000, [10] 0.000, [11] 0.000, [12] 0.000.
    Saved Cache: 1 0: Evenet Id level 326.
    6) SearchIndexer (3476) Windows: The database engine started a new instance (0). (Time=0 seconds)
    7) Internal Timing Sequence: [1] 0.000, [2] 0.000, [3] 0.000, [4] 0.000, [5] 0.000, [6] 0.000, [7] 0.000, [8] 0.000, [9] 0.000, [10] 0.000. eveent level 105
    8) SearchIndexer (3476) Windows: The database engine (6.03.9600.0000) is starting a new instance (0). Error Level 102
    Under Security:
    1) We might want to check this out here User Account Management changed?
    Under Setup: no errors.
    Under System below:
    1) Name resolution for the name win8.ipv6.microsoft.com. timed out after none of the configured DNS servers responded.Event level  1014
    2) Intel(R) 82567LM-3 Gigabit Network Connection
     Network link is disconnected.
    3) The system has returned from a low power state.
    Sleep Time: ‎2014‎-‎08‎-‎29T05:10:07.602701000Z
    Wake Time: ‎2014‎-‎08‎-‎29T13:13:47.945773100Z
    Wake Source: Device -USB Root Hub : Error level 1
    4) The browser has forced an election on network \Device\NetBT_Tcpip_{58565081-3013-43B6-AE07-CC89C71F6036} because a master browser was stopped. Event Id 8033.
    5) The driver \Driver\WudfRd failed to load for the device SWD\WPDBUSENUM\_??_USBSTOR#Disk&Ven_EPSON&Prod_Storage&Rev_1.00#7&2d369789&0&533536503532383375&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}. Event error 219.
    6) The driver \Driver\WudfRd failed to load for the device SWD\WPDBUSENUM\{3c83e4cf-28e9-11e4-827b-b8ac6f8aec21}#0000000000004000. Error Level Id 219.
    7) The UMDF reflector was unable to complete startup because the WUDFPf service was not found.  This service may be started later during boot, at which point Windows will attempt to start the device again. Error Id 10114.
    8) Unable to bind to the underlying transport for [::]:80. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine.  The data field contains the error number. Event Id 15005.
    9) The supersafer64 service failed to start due to the following error:
    The system cannot find the file specified. Event ID 7000.
    10) The SNMP Service encountered an error while accessing the registry key SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration. Error: 1500.
    11) The SAS Core Service service failed to start due to the following error:
    The system cannot find the file specified. 7000
    12 The World Wide Web Publishing Service (WWW Service) did not register the URL prefix http://*:80/ for site 1. The site has been disabled. The data field contains the error number. 1004
    13) The driver \Driver\WudfRd failed to load for the device SWD\WPDBUSENUM\_??_USBSTOR#Disk&Ven_EPSON&Prod_Storage&Rev_1.00#7&2d369789&0&533536503532383375&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}. Error level 219
    14) Name resolution for the name win8.ipv6.microsoft.com. timed out after none of the configured DNS servers responded. Error level 1014.
    Now I need help with all these error since Windows 8 with maybe 15 applications is failing after no setup errors? What would cause these we need to find out? Since I can not use your product with so many developer errors? and to put out a products that doesn
    work is pointless? So please call me and have some help me through the errors and tell your support to stop ignoring the errors that broke the products?
    Sincerely, William Dunlap {removed} N. Academy blvd, 201, Colorado Springs, CO 80910 http:\\interfacesone.fnhost.org
    {removed}.  I need a tech to help me get my web server up?

    So now you don't release the security breaches in windows 8. You mean to tell me that you can use Powershell - Using WMI to breach security in VB apps on the web by getting my file structures?
    What is this all about?
     1 Set VPN NIC Settings
        2 Get Network Data from servers
    Set VPN NIC Settings
    $error.clear | out-null
    cls
    $ErrorActionPreference = "SilentlyContinue"
    if ( $Args.Count -ne 1 ) { "
    Not enough arguments
    Usage :
        script.ps1 server
    "; exit }
    $server = $Args[0].ToLower()
    "We are working with $server"
    $netAdapt = get-wmiobject -class Win32_NetworkAdapter -computer $server
    if (!($netAdapt)) {  
        "Failed to connect to the target server!"
        exit(5)
    foreach ($card in $netAdapt) {
        IF (!([string]::IsNullOrEmpty($card.NetConnectionID))) {
            if ($card.NetConnectionID.CompareTo("VPN Virtual NIC") -eq 0) {
                $myID = $card.DeviceID
    $NAC = [wmi]"\\$server\root\cimv2:Win32_NetworkAdapterConfiguration.index='$myid'"
    $guid=$NAC.settingID
    "Setting DNS Toggles"
    $dnsToggle = $NAC.SetDynamicDNSRegistration(0,0)
    if ($dnsToggle) {
            "Success"
        } else {
            "Failure"
    $strShowNicKeyName = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\$guid\connection"
    #$strShowNicKeyName
    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
    $regKey= $reg.OpenSubKey("$strShowNicKeyName",$true)
    $showIcon = $regKey.GetValue("ShowIcon")
    if (!($showIcon -eq 1)) {
        "The icon is hidden.. Setting it now"
        $setIcon = $regKey.SetValue('ShowIcon',1,'DWORD')
       } else {
        "The icon is visible already."
    "Script Ends"
    Get Network Data from servers
    $myfile = get-content servers.txt
    echo "Server    IPs    Subnet    GW" | out-file "Results.txt" -Append
    foreach ($server in $myfile) {
        Write-Host "Looking at $server"
        $colitems = Get-WmiObject win32_NetworkAdapterConfiguration -computer "$server" -Filter 'IPEnabled = "True"' | select ipaddress,ipsubnet,index,defaultipgateway
        foreach($objItem in $colItems) {
        Write-Host ""
        $myip = $objItem.IPAddress -join " "
        $mySubnet = $objItem.IPSubnet  
        $myGW = $objItem.DefaultIPGateway
        $temp = $objItem.index
        $myid = Get-WmiObject win32_NetworkAdapter -computer "$server" -Filter "index = $temp" | select  netconnectionid
        $myid = $myid -replace "@{netconnectionid=",""
        $myid = $myid -Replace "}",""
        echo "$server    $myip    $mySubnet    $myGW    $myid"
        echo "$server    $myip    $mySubnet    $myGW    $myid"  | out-file "Results.txt" -Append
    Is this possible on any machine with power shell and if so how is access done?
    William Dunlap

  • Harvesting asset info and output to CSV

    I need a script modified that will run on all servers in a work group in order to gather asset data on the appliances running Windows Server 2000 embedded edition. There are no domain services and these systems and this network technology is not an option
    in our environment due to proprietary security, networking and infrastructure restrictions. I have found a script that works but i need it modified to output to a csv as it wont output and .xls .xlsx properly. The script will be run on the only computer on
    the network that can access these devices. Any help on this would be awesome.
    ' Get Windows Server Information
    ' Written By Kely Mulcahey, E.C.S. LLC.
    ' Created: March 1, 2006
    ' Version: 3.0, Revised 5/30/2014
    On Error Resume Next
    Dim PUBOSVer ' Global OS Version
    ' Open File For Writing
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Const ForReading = 1
    ' Get Server List
    strServerFilename = "servers.txt"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(strServerFilename) Then
    ' Open Servers File
    Set objServers = objFSO.OpenTextFile(strServerFilename, ForReading)
    Else
    ' Server File is missing: Exit
    intMsg = MsgBox("File: " & Chr(34) & UCASE(strServerFilename) & Chr(34) & _
    " is either " & _
    "Missing or Damaged!" & vbcrlf & _
    vbcrlf & _
    "This Script will now Exit.", vbCritical, "Server File Error")
    WScript.Quit(0)
    End If
    Do Until objServers.AtEndOfStream
    strNewServer = Trim(objServers.ReadLine)
    strServerList = strServerList & strNewServer & vbcrlf
    intServerCnt = intServerCnt + 1
    Loop
    ' Enumerate Server Array
    For a = 0 To intServerCnt - 1
    strServer = Split(strServerList, vbcrlf)
    Next
    ' Create Excel Spreadsheet
    Set objXLA = CreateObject("Excel.Application")
    objXLA.Visible = False
    objXLA.DisplayAlerts = False
    Set objWorkbook = objXLA.Workbooks.Add()
    Set objWorksheet = objWorkbook.Worksheets(1)
    'Excel Constants
    Const xlEdgeLeft = 7
    Const xlContinuous = 1
    Const xlNone = -4142
    Const xlMedium = -4138
    Const xlThin = 2
    'Set Headers
    ' System Information
    objXLA.Cells(1,1).Value = "Service ID"
    objXLA.Cells(1,2).Value = "Company Name"
    objXLA.Cells(1,3).Value = "Manufacturer"
    objXLA.Cells(1,4).Value = "Model"
    objXLA.Cells(1,5).Value = "Operating System"
    ' Processors
    objXLA.Cells(1,6).Value = "Processor Type"
    objXLA.Cells(1,7).Value = "Processors"
    ' RAM
    objXLA.Cells(1,8).Value = "RAM"
    objXLA.Cells(1,9).Value = "Slots"
    objXLA.Cells(1,10).Value = "Max Capacity"
    ' Network
    objXLA.Cells(1,11).Value = "NIC Port"
    objXLA.Cells(1,12).Value = "Speed"
    objXLA.Cells(1,13).Value = "Connection Name"
    objXLA.Cells(1,14).Value = "Primary IP"
    objXLA.Cells(1,15).Value = "Virtual IP"
    objXLA.Cells(1,16).Value = "Primary DNS"
    objXLA.Cells(1,17).Value = "Secondary DNS"
    ' Hard Disks
    objXLA.Cells(1,18).Value = "Interface"
    objXLA.Cells(1,19).Value = "Physical Disks"
    objXLA.Cells(1,20).Value = "Disk Size"
    objXLA.Cells(1,21).Value = "Fault Tolerant"
    objXLA.Cells(1,22).Value = "Hot Spare"
    ' Set Top Line
    objXLA.Cells(1, 1).EntireRow.Font.Bold = True
    objXLA.Cells(1, 1).EntireRow.Font.Underline = True
    For b = 0 To UBound(strServer) - 1
    strServerParts = Split(strServer(b), " ")
    strComputer = strServerParts(0)
    ' Parse Server Information
    If UBound(strServerParts) = 2 Then
    strUsername = Trim(strServerParts(1))
    strPassword = Trim(strServerParts(2))
    End If
    ' Create Connection Object
    Set objWMIService = Nothing
    Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objSWbemLocator.ConnectServer _
    (strComputer, "root\cimv2", strUsername, strPassword)
    objWMIServices.Security_.ImpersonationLevel = 3
    ' Check if Server Exists
    For intWMICheck = 0 To 15
    If Not objWMIService Is Nothing Then
    Exit For
    Else
    WScript.Sleep(1000)
    End If
    Next
    ' Server Exists
    If intWMICheck < 15 Then
    ' Get CPU Information
    Set colProcessor = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
    For Each colProc In colProcessor
    strManuf = colProc.Manufacturer
    strDescription = ProcessorName(colProc.Name)
    strClockSpeed = colProc.CurrentClockSpeed
    strSocket = strSocket & colProc.SocketDesignation & vbcrlf
    strProcID = strProcID & colProc.ProcessorID & vbcrlf
    strUniqueID = strUniqueID & colProc.UniqueID & vbcrlf
    ProcCount = ProcCount + 1
    Next
    ' Determine if Hyperthreading is Enabled
    strHTStatus = GetHTStatus(strSocket, ProcCount, strProcID, strUniqueID)
    ' DC / HT Results
    If strHTStatus = "True" Then
    If InStr(strManuf, "Intel") Then
    strDescription = strDescription & " (Dual Core or H/T)"
    Else
    strDescription = strDescription & " (Dual Core)"
    End If
    ProcCount = ProcCount / 2
    End If
    ' Export Information
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colCS = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
    ' Write Basic System Information
    For Each objItem in colCS
    Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
    For Each objItemOS in colOS
    ' Get SP Version
    If objItemOS.CSDVersion <> "" Then
    strSPVersion = objItemOS.CSDVersion
    Else
    strSPVersion = "No Service Packs Installed"
    End If
    If objItemOS.LastBootUpTime <> "" Then
    strLastBoot = DateConvert(objItemOS.LastBootUpTime)
    Else
    strLastBoot = "N/A"
    End If
    ' Set OS Version Information
    PUBOSVer = objItemOS.Caption
    objXLA.Cells(b + 2, 1).Value = objItemOS.csname
    objXLA.Cells(b + 2, 3).Value = objItem.Manufacturer
    objXLA.Cells(b + 2, 4).Value = objItem.Model
    objXLA.Cells(b + 2, 5).Value = PUBOSVer & " - " & strSPVersion
    objXLA.Cells(b + 2, 6).Value = strDescription
    objXLA.Cells(b + 2, 7).Value = ProcCount
    objXLA.Cells(b + 2, 8).Value = MemoryConvert(objItem.TotalPhysicalMemory)
    Next
    Next
    ' Get Memory Breakdown
    Dim strMemBreak
    strMemBreak = Split(MemoryBreakdown(), vbcrlf)
    n = 0
    For n = 0 To UBound(strMemBreak) - 1
    strSlots = strSlots & strMemBreak(n) & Chr(10)
    Next
    strMaxCapacity = strMemBreak(UBound(strMemBreak))
    objXLA.Cells(b + 2, 9).Value = Left(strSlots, Len(strSlots) - 1)
    objXLA.Cells(b + 2, 10).Value = strMaxCapacity
    ' Dispose
    strMemBreak = ""
    strMaxCapacity = ""
    strSlots = ""
    '--------------Computer Information (End)------------------'
    '-------------Partition Information (Start)----------------'
    ' Get Drive Count
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set DiskItemsParent = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
    intCount = DiskItemsParent.Count
    ' Process Drives
    intDriveMark = 0
    For i = 0 To intCount - 1
    Set DiskItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive WHERE Index = " & i)
    For Each diskItem in DiskItems
    ' Convert Drive Size
    If diskItem.Size <> "" Then strSize = strSize & ByteConvert(diskItem.Size) & Chr(10) Else strSize = "N/A" & Chr(10)
    If diskItem.StatusInfo <> "" Then strStsInfo = diskItem.StatusInfo Else strStsInfo = "N/A"
    If diskItem.SCSIBus <> "" Then strSCSIBus = diskItem.SCSIBus Else strSCSIBus = "N/A"
    If diskItem.SCSILogicalUnit <> "" Then strSCSILog = diskItem.SCSILogicalUnit Else strSCSILog = "N/A"
    If diskItem.SCSIPort <> "" Then strSCSIPort = diskItem.SCSIPort Else strSCSIPort = "N/A"
    If diskItem.SCSITargetId <> "" Then strSCSITarget = diskItem.SCSITargetId Else strSCSITarget = "N/A"
    ' Get Model
    strModel = Split(diskItem.Model, " ")
    ' Detect HP Array
    If (UCase(strModel(0)) = "HP" Or UCase(strModel(0)) = "COMPAQ") And intDriveMark = 0 Then
    strGetHPArray = GetHPArray(strComputer, strUsername, strPassword)
    If strGetHPArray <> "" Then
    strSplitHP = Split(strGetHPArray, Chr(13))
    For a = 0 To UBound(strSplitHP)
    strSplitResult = Split(strSplitHP(a), ":")
    i = i + 1
    strDriveCount = strDriveCount & Trim(strSplitResult(0)) & Chr(10)
    strDriveSize = strDriveSize & Trim(strSplitResult(1)) & Chr(10)
    strDriveFault = strDriveFault & Trim(strSplitResult(2)) & Chr(10)
    strDriveSpare = strDriveSpare & Trim(strSplitResult(3)) & Chr(10)
    strInterface = strInterface & "HP SCSI" & Chr(10)
    Next
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    intDriveMark = 1 ' Mark That Data was Obtained
    Else
    strDriveCount = strDriveCount & "1" & Chr(10)
    strDriveSize = strDriveSize & strSize & Chr(10)
    strDriveFault = strDriveFault & "N/A" & Chr(10)
    strDriveSpare = strDriveSpare & "N/A" & Chr(10)
    strInterface = strInterface & "HP SCSI " & Chr(10)
    ' Set Controller Output
    intDriveMark = 1 ' Mark That Another Pass is Invalid
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    End If
    Else
    strDriveCount = strDriveCount & "1" & Chr(10)
    strDriveSize = strDriveSize & strSize & Chr(10)
    strDriveFault = strDriveFault & "N/A" & Chr(10)
    strDriveSpare = strDriveSpare & "N/A" & Chr(10)
    ' Set Controller Output
    intDriveMark = 1 ' Mark That Another Pass is Invalid
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    ' Set Interface
    If diskItem.InterfaceType = "IDE" Then
    strInterface = strInterface & "ATA" & Chr(10)
    Else
    strInterface = strInterface & "SATA/SCSI" & Chr(10)
    End If
    End If
    ' Set Cell Value "Interface"
    objXLA.Cells(b + 2, 18).Value = Left(strInterface, Len(strInterface) - 1)
    Next
    ' Dispose Drive Sizes
    strDriveSize = ""
    Next
    ' Dispose Drive Values
    strDriveCount = ""
    strDriveFault = ""
    strDriveSpare = ""
    strInterface = ""
    '----Partition Information (End)---------------------------'
    '----Network Information (Start)---------------------------'
    Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
    i = 1
    eth = 0
    Dim STOREDIP(0)
    intNum = 0
    For Each objItem in colItems
    If objItem.NetConnectionStatus <> "" Then
    ' Determine Connection Status
    If objItem.NetConnectionStatus = 0 Then
    strNetStat = "Disabled"
    ElseIf objItem.NetConnectionStatus = 2 Then
    strNetStat = "Connected"
    ElseIf objItem.NetConnectionStatus = 7 Then
    strNetStat = "Disconnected"
    Else
    strNetStat = "Unknown"
    End If
    If objItem.NetConnectionStatus <> 0 Then
    ' Get Network Card Information
    Const HKEY_LOCAL_MACHINE = &H80000002
    strKeyPath1 = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
    strKeyPath2 = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
    strHostEntry = "Hostname"
    strDomainEntry = "Domain"
    strNodeEntry = "DhcpNodeType"
    strRoutingEntry = "IPEnableRouter"
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
    objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strHostEntry,strHostname
    objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strDomainEntry,strDomain
    objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strNodeEntry,dwNodeType
    objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strRoutingEntry,dwIPRouting
    Select Case dwNodeType
    Case 4 strNodeType = "Mixed"
    Case 8 strNodeType = "Hybrid"
    Case Else strNodeType = dwNodeType
    End Select
    If dwIPRouting = 0 Then
    strIPRouting = "No"
    ElseIf dwIPRouting = 1 Then
    strIPRouting = "Yes"
    Else
    strIPRouting = "?"
    End If
    Set colFirstNicConfig = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    For Each objFirstNicConfig In colFirstNicConfig
    strDnsWins = objFirstNicConfig.DNSEnabledForWINSResolution
    Next
    Set colNicConfigs = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    ' Display per-adapter settings.
    For Each objNicConfig In colNicConfigs
    intIndex = objNicConfig.Index
    Set objNic = objWMIService.Get("Win32_NetworkAdapter.DeviceID=" & intIndex)
    ' Connection Name
    If GetOsVer > 5 Then
    ' Works only in XP / 2003
    strNetConn = objNic.NetConnectionID
    ElseIf GetOsVer = 5 Then
    strNetConn = ""
    ' Get Home Drive of Remote Server
    Set objShell = CreateObject("WScript.Shell")
    Set objEtherName = objShell.Exec("cmd /c ipconfig | find " & Chr(34) & "Ethernet" & Chr(34))
    strEtherName = objEtherName.StdOut.ReadAll()
    strEtherParse = Split(strEtherName, Chr(13))
    strEtherConn = Split(strEtherParse(eth), " ")
    For y = 2 To UBound(strEtherConn)
    strNetConn = strNetConn & " " & strEtherConn(y)
    Next
    ' Trim Connection Name
    strNetConn = Left(Trim(strNetConn), Len(Trim(strNetConn)) - 1)
    Else
    strNetConn = ""
    End If
    ' IP Addresses
    strIPAddresses = ""
    If Not IsNull(objNicConfig.IPAddress) Then
    For Each strIPAddress In objNicConfig.IPAddress
    strIPAddresses = strIPAddresses & strIPAddress & " "
    Next
    End If
    strIPCollection = Split(strIPAddresses, " ")
    ' Subnets
    strIPSubnets = ""
    If Not IsNull(objNicConfig.IPSubnet) Then
    For Each strIPSubnet In objNicConfig.IPSubnet
    strIPSubnets = strIPSubnets & strIPSubnet & " "
    Next
    End If
    strSMCollection = Split(strIPSubnets, " ")
    ' Virtual IP's
    strVirtual = ""
    If UBound(strIPCollection) > 1 Then
    For IPCount = 1 To UBound(strIPCollection) - 1
    strVirtual = strVirtual & (strIPCollection(IPCount) & " / " & strSMCollection(IPCount)) & Chr(10)
    Next
    strVirtual = Left(strVirtual, Len(strVirtual) - 1)
    End If
    If Trim(strVirtual) = "" Then strVirtual = "N/A"
    ' Gateways
    strDefaultIPGateways = ""
    If Not IsNull(objNicConfig.DefaultIPGateway) Then
    For Each strDefaultIPGateway In objNicConfig.DefaultIPGateway
    strDefaultIPGateways = strDefaultIPGateways & strDefaultIPGateway & " "
    Next
    Else
    strDefaultIPGateways = "N/A"
    End If
    ' If IP is repeated, and was already reported.
    intSkipLoop = 0
    If Trim(strNetConn) <> "" Then
    For j = 0 To intNum - 1
    If STOREDIP(j) = strIPAddresses Then
    intSkipLoop = 1
    Exit For
    End If
    Next
    If intSkipLoop = 0 Then
    ReDim Preserve STOREDIP(intNum)
    STOREDIP(intNum) = strIPAddresses
    intNum = intNum + 1
    End If
    Else
    intSkipLoop = 1
    End If
    ' DNS
    strDNSServerSearchOrder = ""
    If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
    For Each strDNSServer In objNicConfig.DNSServerSearchOrder
    strDNSServerSearchOrder = strDNSServerSearchOrder & strDNSServer & " "
    Next
    strDNS = Split(strDNSServerSearchOrder, " ")
    strDNS1 = strDNS(0)
    If Trim(strDNS1) = "" Then strDNS1 = "N/A"
    If UBound(strDNS) > 1 Then
    strDNS2 = strDNS(1)
    Else
    strDNS2 = "N/A"
    End If
    Else
    strDNS1 = "N/A"
    strDNS2 = "N/A"
    End If
    ' Run Output Process
    If intSkipLoop = 0 Then
    ' Connection Speed
    strSpeed = "Unknown"
    Set objWMIService2 = objSWbemLocator.ConnectServer _
    (strComputer, "root\WMI", strUsername, strPassword)
    objWMIServices.Security_.ImpersonationLevel = 3
    Set listAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed")
    Set enumAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_EnumerateAdapter")
    For Each objAdapter in listAdapters
    For Each objEnum in enumAdapters
    intEnum = Len(objEnum.DeviceName)
    If objNicConfig.SettingID = Right(objEnum.DeviceName, intEnum - 8) Then
    If objEnum.InstanceName = objAdapter.InstanceName Then
    intLength = Len(objAdapter.NdisLinkSpeed/10000)
    If intLength > 3 Then
    strSpeed = Left(objAdapter.NdisLinkSpeed/10000, intLength - 3)
    strSpeed = strSpeed & ".0 Gbps"
    Else
    strSpeed = objAdapter.NdisLinkSpeed/10000 & " Mbps"
    End If
    End If
    End If
    Next
    Next
    strTotalDesc = strTotalDesc & objNicConfig.Description & Chr(10)
    strTotalSpeed = strTotalSpeed & strSpeed & Chr(10)
    strTotalNetConn = strTotalNetConn & strNetConn & Chr(10)
    strPrimaryIP = strPrimaryIP & strIPCollection(0) & " / " & strSMCollection(0) & Chr(10)
    strDNSTotal1 = strDNSTotal1 & strDNS1 & Chr(10)
    strDNSTotal2 = strDNSTotal2 & strDNS2 & Chr(10)
    strTotalVirtual = strTotalVirtual & strVirtual & Chr(10)
    i = i + 1
    eth = eth + 2
    ' Dispose
    strDescription = ""
    ProcCount = 0
    strClockSpeed = ""
    strInterface = ""
    intCount = 0
    strSize = ""
    strSpeed = ""
    strIPCollection = ""
    strVirtual = ""
    strDNS = ""
    strDNS1 = ""
    strDNS2 = ""
    End If
    Next
    ' Output
    ' Trim Leading Chr(10)
    If Left(strPrimaryIP, 1) = Chr(10) Then strPrimaryIP = Right(strPrimaryIP, Len(strPrimaryIP) - 1)
    If Left(strTotalVirtual, 1) = Chr(10) Then strTotalVirtual = Right(strTotalVirtual, Len(strTotalVirtual) - 1)
    If Left(strDNSTotal1, 1) = Chr(10) Then strDNSTotal1 = Right(strDNSTotal1, Len(strDNSTotal1) - 1)
    If Left(strDNSTotal2, 1) = Chr(10) Then strDNSTotal2 = Right(strDNSTotal2, Len(strDNSTotal2) - 1)
    objXLA.Cells(b + 2, 11).Value = Trim(Left(strTotalDesc, Len(strTotalDesc) - 1))
    objXLA.Cells(b + 2, 12).Value = Trim(Left(strTotalSpeed, Len(strTotalSpeed) - 1))
    objXLA.Cells(b + 2, 13).Value = Trim(Left(strTotalNetConn, Len(strTotalNetConn) - 1))
    objXLA.Cells(b + 2, 14).Value = Trim(Left(strPrimaryIP, Len(strPrimaryIP) - 1))
    objXLA.Cells(b + 2, 15).Value = Trim(Left(strTotalVirtual, Len(strTotalVirtual) - 1))
    objXLA.Cells(b + 2, 16).Value = Trim(Left(strDNSTotal1, Len(strDNSTotal1) - 1))
    objXLA.Cells(b + 2, 17).Value = Trim(Left(strDNSTotal2, Len(strDNSTotal2) - 1))
    End If
    End If
    ' Dispose Per Loop
    strTotalDesc = ""
    strTotalSpeed = ""
    strTotalNetConn = ""
    strPrimaryIP = ""
    strDNSTotal1 = ""
    strDNSTotal2 = ""
    strTotalVirtual = ""
    Set eth = 0
    Set i = 0
    Next
    '------------Network Information (End)------------------'
    Else
    'No Data Present
    objXLA.Cells(b + 2, 1).Value = strComputer
    objXLA.Cells(b + 2, 3).Value = "Information Not Available"
    objXLA.Cells(b + 2, 1).EntireRow.Font.Bold = True
    objXLA.Cells(b + 2, 1).EntireRow.Interior.ColorIndex = 44
    End If
    ' Dispose Per Server
    ProcCount = 0
    strSocket = ""
    strProcID = ""
    strUniqueID = ""
    Set objWMIService = Nothing
    Next
    '-----------------Functions (Start)---------------------'
    ' System Memory Conversion
    Function MemoryConvert(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 4 = 0) Then
    intExp = CInt((intLength / 3) - 2)
    Else
    intExp = CInt((intLength / 3) - 1)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = CLng(strMem / (2 ^ (intExp * (10))))
    If Len(intSize) = 1 Then
    strFormat = FormatNumber(CStr(intSize), 2)
    Else
    strFormat = intSize + 1
    End If
    If (intExp = 1) Then
    strMeasure = "KB"
    ElseIf (intExp = 2) Then
    strMeasure = "MB"
    ElseIf (intExp = 3) Then
    strMeasure = "GB"
    ElseIf (intExp = 4) Then
    strMeasure = "TB"
    ElseIf (intExp = 5) Then
    strMeasure = "PB"
    ElseIf (intExp = 6) Then
    strMeasure = "EB"
    End If
    MemoryConvert = strFormat & " " & strMeasure
    End Function
    ' System Byte Conversion
    Function ByteConvert(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 3 = 0) Then
    intExp = (intLength / 3) - 1
    Else
    intExp = (intLength / 3)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = CLng(strMem / (2 ^ (intExp * (10))))
    strFormat = FormatNumber(CStr(intSize), 2)
    If (intExp = 1) Then
    strMeasure = "KB"
    ElseIf (intExp = 2) Then
    strMeasure = "MB"
    ElseIf (intExp = 3) Then
    strMeasure = "GB"
    ElseIf (intExp = 4) Then
    strMeasure = "TB"
    ElseIf (intExp = 5) Then
    strMeasure = "PB"
    ElseIf (intExp = 6) Then
    strMeasure = "EB"
    End If
    ByteConvert = strFormat & " " & strMeasure
    End Function
    ' System RAID Byte Conversion
    Function ByteConvertRAID(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 3 = 0) Then
    intExp = (intLength / 3) - 1
    Else
    intExp = (intLength / 3)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = (strMem / (2 ^ (intExp * (10))))
    strFormat = FormatNumber(CStr(intSize), 2)
    If (intExp = 0) Then
    strMeasure = "MB"
    ElseIf (intExp = 1) Then
    strMeasure = "GB"
    ElseIf (intExp = 2) Then
    strMeasure = "TB"
    ElseIf (intExp = 3) Then
    strMeasure = "PB"
    ElseIf (intExp = 4) Then
    strMeasure = "EB"
    End If
    ByteConvertRAID = strFormat & " " & strMeasure
    End Function
    ' Trim Processor Description
    Function ProcessorName(strName)
    Dim intCounter
    Dim strRead
    Dim chrRead, chrReadMore
    For intCounter = 1 to Len(strName)
    chrRead = Mid(strName, intCounter, 1)
    chrReadMore = Mid(strName, intCounter + 1, 1)
    If ((chrRead <> " ") Or ((chrRead = " ") And (chrReadMore <> " "))) Then
    strRead = strRead & chrRead
    End If
    Next
    ProcessorName = Trim(strRead)
    End Function
    ' Get Hyper-Threading Status
    Function GetHTStatus(strName, intProc, strID, strUnique)
    strNameArray = Split(strName, vbcrlf)
    strIDArray = Split(strID, vbcrlf)
    strUniqueList = Split(strUnique, vbcrlf)
    intTotal = 0
    ' Check Socket Designation
    For i = 0 To UBound(strNameArray) - 1
    intMark = 1
    ' Check for Redundancies
    For j = i + 1 To UBound(strNameArray) - 1
    If strNameArray(i) = strNameArray(j) Then
    intMark = 0
    End If
    Next
    ' If Redundant Unique ID's Exist
    For j = i + 1 To UBound(strNameArray) - 1
    If strUniqueList(i) <> "" And strUniqueList(j) <> "" And _
    (strUniqueList(i) <> strUniqueList(j)) Then
    intMark = 1
    End If
    Next
    ' Check for NULL ProcessorID
    If Trim(strIDArray(i)) = "0000000000000000" Then
    intMark = 0
    End If
    ' Calculate Total
    If intMark = 1 Then
    intTotal = intTotal + intMark
    End If
    Next
    ' Compare Results
    If intProc = 2 * intTotal Then
    GetHTStatus = "True"
    Else
    GetHTStatus = "False"
    End If
    End Function
    ' Get Memory Breakdown
    Function MemoryBreakdown
    Set colPMAItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray",,48)
    For Each objPMAItem in colPMAItems
    lngMax = CLng(objPMAItem.MaxCapacity)
    intCount = CInt(objPMAItem.MemoryDevices)
    Next
    ReDim Preserve strPMArray(intCount)
    Set colPMItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
    For Each objPMItem in colPMItems
    strValue = strValue & objPMItem.DeviceLocator & ": "
    strValue = strValue & objPMItem.Capacity / 2^20 & "MB, "
    strValue = strValue & objPMItem.Speed & "MHz"
    strPMArray(TrimTrailingNumber(objPMItem.Tag)) = strValue
    strValue = ""
    Next
    j = 0
    strResult = ""
    For j = 0 To intCount - 1
    If Trim(strPMArray(j)) = "" Then strPMArray(j) = "<Empty>"
    strResult = strResult & strPMArray(j) & vbcrlf
    Next
    strResult = strResult & (lngMax / 2^10) & "MB"
    MemoryBreakdown = strResult
    End Function
    ' Get Part Name
    Function ExtractPartName(strName)
    Dim chrRead
    Dim strRead
    Dim i
    For i = 2 To Len(strName)
    chrRead = Mid(strName, Len(strName) - (i - 1), 1)
    If chrRead <> Chr(34) Then
    strRead = chrRead & strRead
    Else
    Exit For
    End If
    Next
    ExtractPartName = strRead
    End Function
    ' Get Trailing Number
    Function TrimTrailingNumber(strNum)
    Dim chrRead
    Dim strRead
    Dim intLen
    strNum = Trim(strNum)
    intLen = Len(strNum)
    i = 1
    For i = 1 To intLen
    chrRead = Mid(strNum, intLen - (i - 1), 1)
    If IsNumeric(chrRead) = "True" Then
    strRead = chrRead & strRead
    Else
    Exit For
    End If
    Next
    TrimTrailingNumber = strRead
    End Function
    ' Function: WMIDateStringToDate(dtmDate)
    Function WMIDateToString(dtmDate)
    WMIDateToString = CDate(Mid(dtmDate, 5, 2) & "/" & _
    Mid(dtmDate, 7, 2) & "/" & _
    Left(dtmDate, 4) & " " & _
    Mid(dtmDate, 9, 2) & ":" & _
    Mid(dtmDate, 11, 2) & ":" & _
    Mid(dtmDate, 13, 2))
    End Function
    ' Function: GetOsVer
    Function GetOsVer
    Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem In colOperatingSystems
    GetOSVer = CSng(Left(objOperatingSystem.Version, 3))
    Next
    End Function
    ' Function: GetHPArray
    Function GetHPArray(strComputer2, strUsername2, strPassword2)
    ' Check for 64-bit Windows
    If InStr(PUBOSVer, "x64") Then
    strCompaq = "Program Files (x86)\Compaq\Cpqacuxe\Bin"
    Else
    strCompaq = "Program Files\Compaq\Cpqacuxe\Bin"
    End If
    ' Create Connection Object
    Set objWMIServiceRem = objWMIService.Get("Win32_Process")
    ' Confirm Location of Compaq Array Manager
    Set objHPShell = CreateObject("WScript.Shell")
    Set objHPFSO = CreateObject("Scripting.FileSystemObject")
    Set WshNetwork2 = WScript.CreateObject("WScript.Network")
    WshNetwork2.MapNetworkDrive "", "\\" & strComputer2 & "\C$" ,,strUsername2, strPassword2
    strProgram = "\\" & strComputer2 & "\C$\" & strCompaq & "\cpqacuxe.exe"
    ' Ensure Access is Possible
    If objHPFSO.FileExists(strProgram) Then
    ' Process Array Config
    strProcess = Chr(34) & "C:\" & strCompaq & "\cpqacuxe.exe" & Chr(34) & " -c c:\output.txt"
    Process = objWMIServiceRem.Create(strProcess, null, null, intProcessID)
    ' Check for "output.txt"
    For intTimerHP = 0 To 10
    If objFSO.FileExists("\\" & strComputer2 & "\C$\output.txt") Then
    Exit For
    Else
    WScript.Sleep(1000)
    End If
    Next
    ' Process Output
    If intTimerHP < 10 Then
    ' Check for Locked Output File
    Set objHPOutputFile = objHPFSO.GetFile("\\" & strComputer2 & "\C$\output.txt")
    If objHPOutputFile.Size <> 0 Then
    ' Close File
    Set objHPOutputFile = Nothing
    ' Continue Processesing File
    Set objHPInputFile = objHPFSO.OpenTextFile("\\" & strComputer2 & "\C$\output.txt", ForReading)
    Do Until objHPInputFile.AtEndOfStream
    strHPArray = strHPArray & objHPInputFile.ReadLine & vbcrlf
    Loop
    ' Close Input File
    objHPInputFile.Close
    ' Close Link to Server
    objHPFSO.DeleteFile("\\" & strComputer2 & "\C$\output.txt")
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    ' Create String Array
    strHPParse = Split(strHPArray, vbcrlf)
    ' Parse For Individual RAID Arrays
    Dim strArrayList()
    z = 0
    For i = 0 To UBound(strHPParse)
    j = 0
    ' Array and Drives
    If InStr(strHPParse(i), "Array Specifications") Then
    ReDim Preserve strArrayList(z)
    strArrayList(z) = strArrayList(z) & strHPParse(i) & vbcrlf
    For j = i + 1 To Ubound(strHPParse)
    If InStr(strHPParse(j), "Array Specifications") Then
    Exit For
    Else
    strArrayList(z) = strArrayList(z) & strHPParse(j) & vbcrlf
    End If
    Next
    z = z + 1
    End If
    Next
    ' Process Each RAID Array
    x = 0
    For x = 0 To UBound(strArrayList)
    strListParse = Split(strArrayList(x), vbcrlf)
    For y = 0 To UBound(strListParse)
    ' Drives
    If Left(strListParse(y), 6) = "Drive=" Then
    strDrives = ""
    strDrives = Split(strListParse(y), ",")
    k = 0
    For j = 0 To UBound(strDrives)
    k = k + 1
    Next
    strDriveCount = k ' For Output
    End If
    ' Hot Spare
    If InStr(strListParse(y), "OnlineSpare=") Then
    If InStr(strListParse(y), "OnlineSpare= No") Then
    strHotSpare = strHotSpare & "N" ' For Output
    Else
    strHotSpare = strHotSpare & "Y" ' For Output
    End If
    End If
    ' Logical Drives
    If InStr(strListParse(y), "Logical Drive Specifications") Then
    ' Find First Logical Drive
    strRAID = Split(strListParse(y + 2), " ")
    strRAIDResult = strRAIDResult & "RAID " & strRAID(1) & " / " ' For Output
    strGetDrive = Split(strListParse(y + 3), " ")
    strRAIDSize = strRAIDSize & ByteConvertRAID(strGetDrive(1)) & " / " ' For Output
    End If
    Next
    ' Process Results
    strRAIDSize = Left(strRAIDSize, Len(strRAIDSize) - 3)
    strRAIDResult = Left(strRAIDResult, Len(strRAIDResult) - 3)
    strNewList = strNewList & strDriveCount & _
    ":" & strRAIDSize & ":" & strRAIDResult & ":" & strHotSpare & Chr(13)
    ' Dispose Array Variables
    strDriveCount = ""
    strRAIDSize = ""
    strRAIDResult = ""
    strHotSpare = ""
    Next
    ' Return Array Output
    GetHPArray = Left(strNewList, Len(strNewList) - 1)
    Exit Function
    Else ' "output.txt" Is Locked
    ' Close File
    Set objHPOutputFile = Nothing
    ' Kill Remote Connection
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    Else ' "output.txt" Does not Exist
    ' Kill Remote Connection
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    Else ' "Array Manager Does not Exist
    ' Input not Available
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    End Function
    '--------------------Functions (End)--------------------'
    ' Set Excel Attributes
    Const xlVAlignTop = -4160
    Set objRange2 = objWorksheet.UsedRange
    objRange2.VerticalAlignment = xlVAlignTop
    ' Set Font Attributes
    objXLA.Cells.Font.Size = 8
    objXLA.Cells.Font.Name = "Arial"
    objXLA.Cells.Font.ColorIndex = 11
    objXLA.Cells.EntireColumn.AutoFit
    objXLA.Cells(1, 9).ColumnWidth = 30 ' RAM Slots
    objXLA.Cells(1, 11).ColumnWidth = 40 ' NIC Port
    objXLA.Cells(1, 13).ColumnWidth = 25 ' Connection Name
    objXLA.Cells(1, 14).ColumnWidth = 25 ' Interface IP's
    objXLA.Cells(1, 15).ColumnWidth = 25 ' Virtual IP's
    objXLA.Cells(1, 16).ColumnWidth = 15 ' DNS1
    objXLA.Cells(1, 17).ColumnWidth = 15 ' DNS2
    objXLA.Cells(1, 18).ColumnWidth = 15 ' Interface Type
    objXLA.Cells.HorizontalAlignment = 2 ' Drive Count
    objXLA.Cells(1, 20).ColumnWidth = 20 ' Virtual IP's
    objXLA.Cells(1, 21).ColumnWidth = 20 ' Virtual IP's
    ' Save
    set objFSO2 = CreateObject("Scripting.FileSystemObject")
    strFileName = objFSO2.getAbsolutePathName("") & "\Scan Results.xls"
    objWorkbook.SaveAs(strFileName)
    objWorkbook.Close
    objXLA.Quit
    ' Notify User
    WScript.Echo "Process Completed (" & Now & ")"
    ' Close Program
    WScript.Quit(0)

    I Need my script modified to run this script and output to CSV but its so big I am not sure where to start. I don't need it in XLS at all, and I can add my own headers, cell sizes and colors, etc. so It should just output the data to a simple CSV. 
    On Error Resume Next
    Dim PUBOSVer ' Global OS Version
    ' Open File For Writing
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Const ForReading = 1
    ' Get Server List
    strServerFilename = "servers.txt"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(strServerFilename) Then
    ' Open Servers File
    Set objServers = objFSO.OpenTextFile(strServerFilename, ForReading)
    Else
    ' Server File is missing: Exit
    intMsg = MsgBox("File: " & Chr(34) & UCASE(strServerFilename) & Chr(34) & _
    " is either " & _
    "Missing or Damaged!" & vbcrlf & _
    vbcrlf & _
    "This Script will now Exit.", vbCritical, "Server File Error")
    WScript.Quit(0)
    End If
    Do Until objServers.AtEndOfStream
    strNewServer = Trim(objServers.ReadLine)
    strServerList = strServerList & strNewServer & vbcrlf
    intServerCnt = intServerCnt + 1
    Loop
    ' Enumerate Server Array
    For a = 0 To intServerCnt - 1
    strServer = Split(strServerList, vbcrlf)
    Next
    ' Create Excel Spreadsheet
    Set objXLA = CreateObject("Excel.Application")
    objXLA.Visible = False
    objXLA.DisplayAlerts = False
    Set objWorkbook = objXLA.Workbooks.Add()
    Set objWorksheet = objWorkbook.Worksheets(1)
    'Excel Constants
    Const xlEdgeLeft = 7
    Const xlContinuous = 1
    Const xlNone = -4142
    Const xlMedium = -4138
    Const xlThin = 2
    'Set Headers
    ' System Information
    objXLA.Cells(1,1).Value = "Service ID"
    objXLA.Cells(1,2).Value = "Company Name"
    objXLA.Cells(1,3).Value = "Manufacturer"
    objXLA.Cells(1,4).Value = "Model"
    objXLA.Cells(1,5).Value = "Operating System"
    ' Processors
    objXLA.Cells(1,6).Value = "Processor Type"
    objXLA.Cells(1,7).Value = "Processors"
    ' RAM
    objXLA.Cells(1,8).Value = "RAM"
    objXLA.Cells(1,9).Value = "Slots"
    objXLA.Cells(1,10).Value = "Max Capacity"
    ' Network
    objXLA.Cells(1,11).Value = "NIC Port"
    objXLA.Cells(1,12).Value = "Speed"
    objXLA.Cells(1,13).Value = "Connection Name"
    objXLA.Cells(1,14).Value = "Primary IP"
    objXLA.Cells(1,15).Value = "Virtual IP"
    objXLA.Cells(1,16).Value = "Primary DNS"
    objXLA.Cells(1,17).Value = "Secondary DNS"
    ' Hard Disks
    objXLA.Cells(1,18).Value = "Interface"
    objXLA.Cells(1,19).Value = "Physical Disks"
    objXLA.Cells(1,20).Value = "Disk Size"
    objXLA.Cells(1,21).Value = "Fault Tolerant"
    objXLA.Cells(1,22).Value = "Hot Spare"
    ' Set Top Line
    objXLA.Cells(1, 1).EntireRow.Font.Bold = True
    objXLA.Cells(1, 1).EntireRow.Font.Underline = True
    For b = 0 To UBound(strServer) - 1
    strServerParts = Split(strServer(b), " ")
    strComputer = strServerParts(0)
    ' Parse Server Information
    If UBound(strServerParts) = 2 Then
    strUsername = Trim(strServerParts(1))
    strPassword = Trim(strServerParts(2))
    End If
    ' Create Connection Object
    Set objWMIService = Nothing
    Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objSWbemLocator.ConnectServer _
    (strComputer, "root\cimv2", strUsername, strPassword)
    objWMIServices.Security_.ImpersonationLevel = 3
    ' Check if Server Exists
    For intWMICheck = 0 To 15
    If Not objWMIService Is Nothing Then
    Exit For
    Else
    WScript.Sleep(1000)
    End If
    Next
    ' Server Exists
    If intWMICheck < 15 Then
    ' Get CPU Information
    Set colProcessor = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
    For Each colProc In colProcessor
    strManuf = colProc.Manufacturer
    strDescription = ProcessorName(colProc.Name)
    strClockSpeed = colProc.CurrentClockSpeed
    strSocket = strSocket & colProc.SocketDesignation & vbcrlf
    strProcID = strProcID & colProc.ProcessorID & vbcrlf
    strUniqueID = strUniqueID & colProc.UniqueID & vbcrlf
    ProcCount = ProcCount + 1
    Next
    ' Determine if Hyperthreading is Enabled
    strHTStatus = GetHTStatus(strSocket, ProcCount, strProcID, strUniqueID)
    ' DC / HT Results
    If strHTStatus = "True" Then
    If InStr(strManuf, "Intel") Then
    strDescription = strDescription & " (Dual Core or H/T)"
    Else
    strDescription = strDescription & " (Dual Core)"
    End If
    ProcCount = ProcCount / 2
    End If
    ' Export Information
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colCS = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
    ' Write Basic System Information
    For Each objItem in colCS
    Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
    For Each objItemOS in colOS
    ' Get SP Version
    If objItemOS.CSDVersion <> "" Then
    strSPVersion = objItemOS.CSDVersion
    Else
    strSPVersion = "No Service Packs Installed"
    End If
    If objItemOS.LastBootUpTime <> "" Then
    strLastBoot = DateConvert(objItemOS.LastBootUpTime)
    Else
    strLastBoot = "N/A"
    End If
    ' Set OS Version Information
    PUBOSVer = objItemOS.Caption
    objXLA.Cells(b + 2, 1).Value = objItemOS.csname
    objXLA.Cells(b + 2, 3).Value = objItem.Manufacturer
    objXLA.Cells(b + 2, 4).Value = objItem.Model
    objXLA.Cells(b + 2, 5).Value = PUBOSVer & " - " & strSPVersion
    objXLA.Cells(b + 2, 6).Value = strDescription
    objXLA.Cells(b + 2, 7).Value = ProcCount
    objXLA.Cells(b + 2, 8).Value = MemoryConvert(objItem.TotalPhysicalMemory)
    Next
    Next
    ' Get Memory Breakdown
    Dim strMemBreak
    strMemBreak = Split(MemoryBreakdown(), vbcrlf)
    n = 0
    For n = 0 To UBound(strMemBreak) - 1
    strSlots = strSlots & strMemBreak(n) & Chr(10)
    Next
    strMaxCapacity = strMemBreak(UBound(strMemBreak))
    objXLA.Cells(b + 2, 9).Value = Left(strSlots, Len(strSlots) - 1)
    objXLA.Cells(b + 2, 10).Value = strMaxCapacity
    ' Dispose
    strMemBreak = ""
    strMaxCapacity = ""
    strSlots = ""
    '--------------Computer Information (End)------------------'
    '-------------Partition Information (Start)----------------'
    ' Get Drive Count
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set DiskItemsParent = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
    intCount = DiskItemsParent.Count
    ' Process Drives
    intDriveMark = 0
    For i = 0 To intCount - 1
    Set DiskItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive WHERE Index = " & i)
    For Each diskItem in DiskItems
    ' Convert Drive Size
    If diskItem.Size <> "" Then strSize = strSize & ByteConvert(diskItem.Size) & Chr(10) Else strSize = "N/A" & Chr(10)
    If diskItem.StatusInfo <> "" Then strStsInfo = diskItem.StatusInfo Else strStsInfo = "N/A"
    If diskItem.SCSIBus <> "" Then strSCSIBus = diskItem.SCSIBus Else strSCSIBus = "N/A"
    If diskItem.SCSILogicalUnit <> "" Then strSCSILog = diskItem.SCSILogicalUnit Else strSCSILog = "N/A"
    If diskItem.SCSIPort <> "" Then strSCSIPort = diskItem.SCSIPort Else strSCSIPort = "N/A"
    If diskItem.SCSITargetId <> "" Then strSCSITarget = diskItem.SCSITargetId Else strSCSITarget = "N/A"
    ' Get Model
    strModel = Split(diskItem.Model, " ")
    ' Detect HP Array
    If (UCase(strModel(0)) = "HP" Or UCase(strModel(0)) = "COMPAQ") And intDriveMark = 0 Then
    strGetHPArray = GetHPArray(strComputer, strUsername, strPassword)
    If strGetHPArray <> "" Then
    strSplitHP = Split(strGetHPArray, Chr(13))
    For a = 0 To UBound(strSplitHP)
    strSplitResult = Split(strSplitHP(a), ":")
    i = i + 1
    strDriveCount = strDriveCount & Trim(strSplitResult(0)) & Chr(10)
    strDriveSize = strDriveSize & Trim(strSplitResult(1)) & Chr(10)
    strDriveFault = strDriveFault & Trim(strSplitResult(2)) & Chr(10)
    strDriveSpare = strDriveSpare & Trim(strSplitResult(3)) & Chr(10)
    strInterface = strInterface & "HP SCSI" & Chr(10)
    Next
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    intDriveMark = 1 ' Mark That Data was Obtained
    Else
    strDriveCount = strDriveCount & "1" & Chr(10)
    strDriveSize = strDriveSize & strSize & Chr(10)
    strDriveFault = strDriveFault & "N/A" & Chr(10)
    strDriveSpare = strDriveSpare & "N/A" & Chr(10)
    strInterface = strInterface & "HP SCSI " & Chr(10)
    ' Set Controller Output
    intDriveMark = 1 ' Mark That Another Pass is Invalid
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    End If
    Else
    strDriveCount = strDriveCount & "1" & Chr(10)
    strDriveSize = strDriveSize & strSize & Chr(10)
    strDriveFault = strDriveFault & "N/A" & Chr(10)
    strDriveSpare = strDriveSpare & "N/A" & Chr(10)
    ' Set Controller Output
    intDriveMark = 1 ' Mark That Another Pass is Invalid
    ' Set Controller Output
    objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
    objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
    objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
    objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
    ' Set Interface
    If diskItem.InterfaceType = "IDE" Then
    strInterface = strInterface & "ATA" & Chr(10)
    Else
    strInterface = strInterface & "SATA/SCSI" & Chr(10)
    End If
    End If
    ' Set Cell Value "Interface"
    objXLA.Cells(b + 2, 18).Value = Left(strInterface, Len(strInterface) - 1)
    Next
    ' Dispose Drive Sizes
    strDriveSize = ""
    Next
    ' Dispose Drive Values
    strDriveCount = ""
    strDriveFault = ""
    strDriveSpare = ""
    strInterface = ""
    '----Partition Information (End)---------------------------'
    '----Network Information (Start)---------------------------'
    Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
    i = 1
    eth = 0
    Dim STOREDIP(0)
    intNum = 0
    For Each objItem in colItems
    If objItem.NetConnectionStatus <> "" Then
    ' Determine Connection Status
    If objItem.NetConnectionStatus = 0 Then
    strNetStat = "Disabled"
    ElseIf objItem.NetConnectionStatus = 2 Then
    strNetStat = "Connected"
    ElseIf objItem.NetConnectionStatus = 7 Then
    strNetStat = "Disconnected"
    Else
    strNetStat = "Unknown"
    End If
    If objItem.NetConnectionStatus <> 0 Then
    ' Get Network Card Information
    Const HKEY_LOCAL_MACHINE = &H80000002
    strKeyPath1 = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
    strKeyPath2 = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
    strHostEntry = "Hostname"
    strDomainEntry = "Domain"
    strNodeEntry = "DhcpNodeType"
    strRoutingEntry = "IPEnableRouter"
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
    objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strHostEntry,strHostname
    objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strDomainEntry,strDomain
    objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strNodeEntry,dwNodeType
    objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strRoutingEntry,dwIPRouting
    Select Case dwNodeType
    Case 4 strNodeType = "Mixed"
    Case 8 strNodeType = "Hybrid"
    Case Else strNodeType = dwNodeType
    End Select
    If dwIPRouting = 0 Then
    strIPRouting = "No"
    ElseIf dwIPRouting = 1 Then
    strIPRouting = "Yes"
    Else
    strIPRouting = "?"
    End If
    Set colFirstNicConfig = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    For Each objFirstNicConfig In colFirstNicConfig
    strDnsWins = objFirstNicConfig.DNSEnabledForWINSResolution
    Next
    Set colNicConfigs = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    ' Display per-adapter settings.
    For Each objNicConfig In colNicConfigs
    intIndex = objNicConfig.Index
    Set objNic = objWMIService.Get("Win32_NetworkAdapter.DeviceID=" & intIndex)
    ' Connection Name
    If GetOsVer > 5 Then
    ' Works only in XP / 2003
    strNetConn = objNic.NetConnectionID
    ElseIf GetOsVer = 5 Then
    strNetConn = ""
    ' Get Home Drive of Remote Server
    Set objShell = CreateObject("WScript.Shell")
    Set objEtherName = objShell.Exec("cmd /c ipconfig | find " & Chr(34) & "Ethernet" & Chr(34))
    strEtherName = objEtherName.StdOut.ReadAll()
    strEtherParse = Split(strEtherName, Chr(13))
    strEtherConn = Split(strEtherParse(eth), " ")
    For y = 2 To UBound(strEtherConn)
    strNetConn = strNetConn & " " & strEtherConn(y)
    Next
    ' Trim Connection Name
    strNetConn = Left(Trim(strNetConn), Len(Trim(strNetConn)) - 1)
    Else
    strNetConn = ""
    End If
    ' IP Addresses
    strIPAddresses = ""
    If Not IsNull(objNicConfig.IPAddress) Then
    For Each strIPAddress In objNicConfig.IPAddress
    strIPAddresses = strIPAddresses & strIPAddress & " "
    Next
    End If
    strIPCollection = Split(strIPAddresses, " ")
    ' Subnets
    strIPSubnets = ""
    If Not IsNull(objNicConfig.IPSubnet) Then
    For Each strIPSubnet In objNicConfig.IPSubnet
    strIPSubnets = strIPSubnets & strIPSubnet & " "
    Next
    End If
    strSMCollection = Split(strIPSubnets, " ")
    ' Virtual IP's
    strVirtual = ""
    If UBound(strIPCollection) > 1 Then
    For IPCount = 1 To UBound(strIPCollection) - 1
    strVirtual = strVirtual & (strIPCollection(IPCount) & " / " & strSMCollection(IPCount)) & Chr(10)
    Next
    strVirtual = Left(strVirtual, Len(strVirtual) - 1)
    End If
    If Trim(strVirtual) = "" Then strVirtual = "N/A"
    ' Gateways
    strDefaultIPGateways = ""
    If Not IsNull(objNicConfig.DefaultIPGateway) Then
    For Each strDefaultIPGateway In objNicConfig.DefaultIPGateway
    strDefaultIPGateways = strDefaultIPGateways & strDefaultIPGateway & " "
    Next
    Else
    strDefaultIPGateways = "N/A"
    End If
    ' If IP is repeated, and was already reported.
    intSkipLoop = 0
    If Trim(strNetConn) <> "" Then
    For j = 0 To intNum - 1
    If STOREDIP(j) = strIPAddresses Then
    intSkipLoop = 1
    Exit For
    End If
    Next
    If intSkipLoop = 0 Then
    ReDim Preserve STOREDIP(intNum)
    STOREDIP(intNum) = strIPAddresses
    intNum = intNum + 1
    End If
    Else
    intSkipLoop = 1
    End If
    ' DNS
    strDNSServerSearchOrder = ""
    If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
    For Each strDNSServer In objNicConfig.DNSServerSearchOrder
    strDNSServerSearchOrder = strDNSServerSearchOrder & strDNSServer & " "
    Next
    strDNS = Split(strDNSServerSearchOrder, " ")
    strDNS1 = strDNS(0)
    If Trim(strDNS1) = "" Then strDNS1 = "N/A"
    If UBound(strDNS) > 1 Then
    strDNS2 = strDNS(1)
    Else
    strDNS2 = "N/A"
    End If
    Else
    strDNS1 = "N/A"
    strDNS2 = "N/A"
    End If
    ' Run Output Process
    If intSkipLoop = 0 Then
    ' Connection Speed
    strSpeed = "Unknown"
    Set objWMIService2 = objSWbemLocator.ConnectServer _
    (strComputer, "root\WMI", strUsername, strPassword)
    objWMIServices.Security_.ImpersonationLevel = 3
    Set listAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed")
    Set enumAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_EnumerateAdapter")
    For Each objAdapter in listAdapters
    For Each objEnum in enumAdapters
    intEnum = Len(objEnum.DeviceName)
    If objNicConfig.SettingID = Right(objEnum.DeviceName, intEnum - 8) Then
    If objEnum.InstanceName = objAdapter.InstanceName Then
    intLength = Len(objAdapter.NdisLinkSpeed/10000)
    If intLength > 3 Then
    strSpeed = Left(objAdapter.NdisLinkSpeed/10000, intLength - 3)
    strSpeed = strSpeed & ".0 Gbps"
    Else
    strSpeed = objAdapter.NdisLinkSpeed/10000 & " Mbps"
    End If
    End If
    End If
    Next
    Next
    strTotalDesc = strTotalDesc & objNicConfig.Description & Chr(10)
    strTotalSpeed = strTotalSpeed & strSpeed & Chr(10)
    strTotalNetConn = strTotalNetConn & strNetConn & Chr(10)
    strPrimaryIP = strPrimaryIP & strIPCollection(0) & " / " & strSMCollection(0) & Chr(10)
    strDNSTotal1 = strDNSTotal1 & strDNS1 & Chr(10)
    strDNSTotal2 = strDNSTotal2 & strDNS2 & Chr(10)
    strTotalVirtual = strTotalVirtual & strVirtual & Chr(10)
    i = i + 1
    eth = eth + 2
    ' Dispose
    strDescription = ""
    ProcCount = 0
    strClockSpeed = ""
    strInterface = ""
    intCount = 0
    strSize = ""
    strSpeed = ""
    strIPCollection = ""
    strVirtual = ""
    strDNS = ""
    strDNS1 = ""
    strDNS2 = ""
    End If
    Next
    ' Output
    ' Trim Leading Chr(10)
    If Left(strPrimaryIP, 1) = Chr(10) Then strPrimaryIP = Right(strPrimaryIP, Len(strPrimaryIP) - 1)
    If Left(strTotalVirtual, 1) = Chr(10) Then strTotalVirtual = Right(strTotalVirtual, Len(strTotalVirtual) - 1)
    If Left(strDNSTotal1, 1) = Chr(10) Then strDNSTotal1 = Right(strDNSTotal1, Len(strDNSTotal1) - 1)
    If Left(strDNSTotal2, 1) = Chr(10) Then strDNSTotal2 = Right(strDNSTotal2, Len(strDNSTotal2) - 1)
    objXLA.Cells(b + 2, 11).Value = Trim(Left(strTotalDesc, Len(strTotalDesc) - 1))
    objXLA.Cells(b + 2, 12).Value = Trim(Left(strTotalSpeed, Len(strTotalSpeed) - 1))
    objXLA.Cells(b + 2, 13).Value = Trim(Left(strTotalNetConn, Len(strTotalNetConn) - 1))
    objXLA.Cells(b + 2, 14).Value = Trim(Left(strPrimaryIP, Len(strPrimaryIP) - 1))
    objXLA.Cells(b + 2, 15).Value = Trim(Left(strTotalVirtual, Len(strTotalVirtual) - 1))
    objXLA.Cells(b + 2, 16).Value = Trim(Left(strDNSTotal1, Len(strDNSTotal1) - 1))
    objXLA.Cells(b + 2, 17).Value = Trim(Left(strDNSTotal2, Len(strDNSTotal2) - 1))
    End If
    End If
    ' Dispose Per Loop
    strTotalDesc = ""
    strTotalSpeed = ""
    strTotalNetConn = ""
    strPrimaryIP = ""
    strDNSTotal1 = ""
    strDNSTotal2 = ""
    strTotalVirtual = ""
    Set eth = 0
    Set i = 0
    Next
    '------------Network Information (End)------------------'
    Else
    'No Data Present
    objXLA.Cells(b + 2, 1).Value = strComputer
    objXLA.Cells(b + 2, 3).Value = "Information Not Available"
    objXLA.Cells(b + 2, 1).EntireRow.Font.Bold = True
    objXLA.Cells(b + 2, 1).EntireRow.Interior.ColorIndex = 44
    End If
    ' Dispose Per Server
    ProcCount = 0
    strSocket = ""
    strProcID = ""
    strUniqueID = ""
    Set objWMIService = Nothing
    Next
    '-----------------Functions (Start)---------------------'
    ' System Memory Conversion
    Function MemoryConvert(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 4 = 0) Then
    intExp = CInt((intLength / 3) - 2)
    Else
    intExp = CInt((intLength / 3) - 1)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = CLng(strMem / (2 ^ (intExp * (10))))
    If Len(intSize) = 1 Then
    strFormat = FormatNumber(CStr(intSize), 2)
    Else
    strFormat = intSize + 1
    End If
    If (intExp = 1) Then
    strMeasure = "KB"
    ElseIf (intExp = 2) Then
    strMeasure = "MB"
    ElseIf (intExp = 3) Then
    strMeasure = "GB"
    ElseIf (intExp = 4) Then
    strMeasure = "TB"
    ElseIf (intExp = 5) Then
    strMeasure = "PB"
    ElseIf (intExp = 6) Then
    strMeasure = "EB"
    End If
    MemoryConvert = strFormat & " " & strMeasure
    End Function
    ' System Byte Conversion
    Function ByteConvert(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 3 = 0) Then
    intExp = (intLength / 3) - 1
    Else
    intExp = (intLength / 3)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = CLng(strMem / (2 ^ (intExp * (10))))
    strFormat = FormatNumber(CStr(intSize), 2)
    If (intExp = 1) Then
    strMeasure = "KB"
    ElseIf (intExp = 2) Then
    strMeasure = "MB"
    ElseIf (intExp = 3) Then
    strMeasure = "GB"
    ElseIf (intExp = 4) Then
    strMeasure = "TB"
    ElseIf (intExp = 5) Then
    strMeasure = "PB"
    ElseIf (intExp = 6) Then
    strMeasure = "EB"
    End If
    ByteConvert = strFormat & " " & strMeasure
    End Function
    ' System RAID Byte Conversion
    Function ByteConvertRAID(strMem)
    Dim intLength
    Dim intExp
    Dim intSize
    Dim strSize
    Dim strMeasure
    Dim strMemory
    intLength = Len(strMem)
    If (intLength Mod 3 = 0) Then
    intExp = (intLength / 3) - 1
    Else
    intExp = (intLength / 3)
    End If
    ' Convert to Lowest Integer Value
    For intCount = 1 To Len(intExp)
    chrRead = Mid(intExp, intCount, 1)
    If chrRead = "." Then
    Exit For
    Else
    strRead = strRead & chrRead
    End If
    Next
    intExp = Cint(strRead)
    intSize = (strMem / (2 ^ (intExp * (10))))
    strFormat = FormatNumber(CStr(intSize), 2)
    If (intExp = 0) Then
    strMeasure = "MB"
    ElseIf (intExp = 1) Then
    strMeasure = "GB"
    ElseIf (intExp = 2) Then
    strMeasure = "TB"
    ElseIf (intExp = 3) Then
    strMeasure = "PB"
    ElseIf (intExp = 4) Then
    strMeasure = "EB"
    End If
    ByteConvertRAID = strFormat & " " & strMeasure
    End Function
    ' Trim Processor Description
    Function ProcessorName(strName)
    Dim intCounter
    Dim strRead
    Dim chrRead, chrReadMore
    For intCounter = 1 to Len(strName)
    chrRead = Mid(strName, intCounter, 1)
    chrReadMore = Mid(strName, intCounter + 1, 1)
    If ((chrRead <> " ") Or ((chrRead = " ") And (chrReadMore <> " "))) Then
    strRead = strRead & chrRead
    End If
    Next
    ProcessorName = Trim(strRead)
    End Function
    ' Get Hyper-Threading Status
    Function GetHTStatus(strName, intProc, strID, strUnique)
    strNameArray = Split(strName, vbcrlf)
    strIDArray = Split(strID, vbcrlf)
    strUniqueList = Split(strUnique, vbcrlf)
    intTotal = 0
    ' Check Socket Designation
    For i = 0 To UBound(strNameArray) - 1
    intMark = 1
    ' Check for Redundancies
    For j = i + 1 To UBound(strNameArray) - 1
    If strNameArray(i) = strNameArray(j) Then
    intMark = 0
    End If
    Next
    ' If Redundant Unique ID's Exist
    For j = i + 1 To UBound(strNameArray) - 1
    If strUniqueList(i) <> "" And strUniqueList(j) <> "" And _
    (strUniqueList(i) <> strUniqueList(j)) Then
    intMark = 1
    End If
    Next
    ' Check for NULL ProcessorID
    If Trim(strIDArray(i)) = "0000000000000000" Then
    intMark = 0
    End If
    ' Calculate Total
    If intMark = 1 Then
    intTotal = intTotal + intMark
    End If
    Next
    ' Compare Results
    If intProc = 2 * intTotal Then
    GetHTStatus = "True"
    Else
    GetHTStatus = "False"
    End If
    End Function
    ' Get Memory Breakdown
    Function MemoryBreakdown
    Set colPMAItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray",,48)
    For Each objPMAItem in colPMAItems
    lngMax = CLng(objPMAItem.MaxCapacity)
    intCount = CInt(objPMAItem.MemoryDevices)
    Next
    ReDim Preserve strPMArray(intCount)
    Set colPMItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
    For Each objPMItem in colPMItems
    strValue = strValue & objPMItem.DeviceLocator & ": "
    strValue = strValue & objPMItem.Capacity / 2^20 & "MB, "
    strValue = strValue & objPMItem.Speed & "MHz"
    strPMArray(TrimTrailingNumber(objPMItem.Tag)) = strValue
    strValue = ""
    Next
    j = 0
    strResult = ""
    For j = 0 To intCount - 1
    If Trim(strPMArray(j)) = "" Then strPMArray(j) = "<Empty>"
    strResult = strResult & strPMArray(j) & vbcrlf
    Next
    strResult = strResult & (lngMax / 2^10) & "MB"
    MemoryBreakdown = strResult
    End Function
    ' Get Part Name
    Function ExtractPartName(strName)
    Dim chrRead
    Dim strRead
    Dim i
    For i = 2 To Len(strName)
    chrRead = Mid(strName, Len(strName) - (i - 1), 1)
    If chrRead <> Chr(34) Then
    strRead = chrRead & strRead
    Else
    Exit For
    End If
    Next
    ExtractPartName = strRead
    End Function
    ' Get Trailing Number
    Function TrimTrailingNumber(strNum)
    Dim chrRead
    Dim strRead
    Dim intLen
    strNum = Trim(strNum)
    intLen = Len(strNum)
    i = 1
    For i = 1 To intLen
    chrRead = Mid(strNum, intLen - (i - 1), 1)
    If IsNumeric(chrRead) = "True" Then
    strRead = chrRead & strRead
    Else
    Exit For
    End If
    Next
    TrimTrailingNumber = strRead
    End Function
    ' Function: WMIDateStringToDate(dtmDate)
    Function WMIDateToString(dtmDate)
    WMIDateToString = CDate(Mid(dtmDate, 5, 2) & "/" & _
    Mid(dtmDate, 7, 2) & "/" & _
    Left(dtmDate, 4) & " " & _
    Mid(dtmDate, 9, 2) & ":" & _
    Mid(dtmDate, 11, 2) & ":" & _
    Mid(dtmDate, 13, 2))
    End Function
    ' Function: GetOsVer
    Function GetOsVer
    Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem In colOperatingSystems
    GetOSVer = CSng(Left(objOperatingSystem.Version, 3))
    Next
    End Function
    ' Function: GetHPArray
    Function GetHPArray(strComputer2, strUsername2, strPassword2)
    ' Check for 64-bit Windows
    If InStr(PUBOSVer, "x64") Then
    strCompaq = "Program Files (x86)\Compaq\Cpqacuxe\Bin"
    Else
    strCompaq = "Program Files\Compaq\Cpqacuxe\Bin"
    End If
    ' Create Connection Object
    Set objWMIServiceRem = objWMIService.Get("Win32_Process")
    ' Confirm Location of Compaq Array Manager
    Set objHPShell = CreateObject("WScript.Shell")
    Set objHPFSO = CreateObject("Scripting.FileSystemObject")
    Set WshNetwork2 = WScript.CreateObject("WScript.Network")
    WshNetwork2.MapNetworkDrive "", "\\" & strComputer2 & "\C$" ,,strUsername2, strPassword2
    strProgram = "\\" & strComputer2 & "\C$\" & strCompaq & "\cpqacuxe.exe"
    ' Ensure Access is Possible
    If objHPFSO.FileExists(strProgram) Then
    ' Process Array Config
    strProcess = Chr(34) & "C:\" & strCompaq & "\cpqacuxe.exe" & Chr(34) & " -c c:\output.txt"
    Process = objWMIServiceRem.Create(strProcess, null, null, intProcessID)
    ' Check for "output.txt"
    For intTimerHP = 0 To 10
    If objFSO.FileExists("\\" & strComputer2 & "\C$\output.txt") Then
    Exit For
    Else
    WScript.Sleep(1000)
    End If
    Next
    ' Process Output
    If intTimerHP < 10 Then
    ' Check for Locked Output File
    Set objHPOutputFile = objHPFSO.GetFile("\\" & strComputer2 & "\C$\output.txt")
    If objHPOutputFile.Size <> 0 Then
    ' Close File
    Set objHPOutputFile = Nothing
    ' Continue Processesing File
    Set objHPInputFile = objHPFSO.OpenTextFile("\\" & strComputer2 & "\C$\output.txt", ForReading)
    Do Until objHPInputFile.AtEndOfStream
    strHPArray = strHPArray & objHPInputFile.ReadLine & vbcrlf
    Loop
    ' Close Input File
    objHPInputFile.Close
    ' Close Link to Server
    objHPFSO.DeleteFile("\\" & strComputer2 & "\C$\output.txt")
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    ' Create String Array
    strHPParse = Split(strHPArray, vbcrlf)
    ' Parse For Individual RAID Arrays
    Dim strArrayList()
    z = 0
    For i = 0 To UBound(strHPParse)
    j = 0
    ' Array and Drives
    If InStr(strHPParse(i), "Array Specifications") Then
    ReDim Preserve strArrayList(z)
    strArrayList(z) = strArrayList(z) & strHPParse(i) & vbcrlf
    For j = i + 1 To Ubound(strHPParse)
    If InStr(strHPParse(j), "Array Specifications") Then
    Exit For
    Else
    strArrayList(z) = strArrayList(z) & strHPParse(j) & vbcrlf
    End If
    Next
    z = z + 1
    End If
    Next
    ' Process Each RAID Array
    x = 0
    For x = 0 To UBound(strArrayList)
    strListParse = Split(strArrayList(x), vbcrlf)
    For y = 0 To UBound(strListParse)
    ' Drives
    If Left(strListParse(y), 6) = "Drive=" Then
    strDrives = ""
    strDrives = Split(strListParse(y), ",")
    k = 0
    For j = 0 To UBound(strDrives)
    k = k + 1
    Next
    strDriveCount = k ' For Output
    End If
    ' Hot Spare
    If InStr(strListParse(y), "OnlineSpare=") Then
    If InStr(strListParse(y), "OnlineSpare= No") Then
    strHotSpare = strHotSpare & "N" ' For Output
    Else
    strHotSpare = strHotSpare & "Y" ' For Output
    End If
    End If
    ' Logical Drives
    If InStr(strListParse(y), "Logical Drive Specifications") Then
    ' Find First Logical Drive
    strRAID = Split(strListParse(y + 2), " ")
    strRAIDResult = strRAIDResult & "RAID " & strRAID(1) & " / " ' For Output
    strGetDrive = Split(strListParse(y + 3), " ")
    strRAIDSize = strRAIDSize & ByteConvertRAID(strGetDrive(1)) & " / " ' For Output
    End If
    Next
    ' Process Results
    strRAIDSize = Left(strRAIDSize, Len(strRAIDSize) - 3)
    strRAIDResult = Left(strRAIDResult, Len(strRAIDResult) - 3)
    strNewList = strNewList & strDriveCount & _
    ":" & strRAIDSize & ":" & strRAIDResult & ":" & strHotSpare & Chr(13)
    ' Dispose Array Variables
    strDriveCount = ""
    strRAIDSize = ""
    strRAIDResult = ""
    strHotSpare = ""
    Next
    ' Return Array Output
    GetHPArray = Left(strNewList, Len(strNewList) - 1)
    Exit Function
    Else ' "output.txt" Is Locked
    ' Close File
    Set objHPOutputFile = Nothing
    ' Kill Remote Connection
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    Else ' "output.txt" Does not Exist
    ' Kill Remote Connection
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    Else ' "Array Manager Does not Exist
    ' Input not Available
    Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
    Do While (objGetHPArray.Status = 0)
    WScript.Sleep(500)
    Loop
    GetHPArray = ""
    Exit Function
    End If
    End Function
    '--------------------Functions (End)--------------------'
    ' Set Excel Attributes
    Const xlVAlignTop = -4160
    Set objRange2 = objWorksheet.UsedRange
    objRange2.VerticalAlignment = xlVAlignTop
    ' Set Font Attributes
    objXLA.Cells.Font.Size = 8
    objXLA.Cells.Font.Name = "Arial"
    objXLA.Cells.Font.ColorIndex = 11
    objXLA.Cells.EntireColumn.AutoFit
    objXLA.Cells(1, 9).ColumnWidth = 30 ' RAM Slots
    objXLA.Cells(1, 11).ColumnWidth = 40 ' NIC Port
    objXLA.Cells(1, 13).ColumnWidth = 25 ' Connection Name
    objXLA.Cells(1, 14).ColumnWidth = 25 ' Interface IP's
    objXLA.Cells(1, 15).ColumnWidth = 25 ' Virtual IP's
    objXLA.Cells(1, 16).ColumnWidth = 15 ' DNS1
    objXLA.Cells(1, 17).ColumnWidth = 15 ' DNS2
    objXLA.Cells(1, 18).ColumnWidth = 15 ' Interface Type
    objXLA.Cells.HorizontalAlignment = 2 ' Drive Count
    objXLA.Cells(1, 20).ColumnWidth = 20 ' Virtual IP's
    objXLA.Cells(1, 21).ColumnWidth = 20 ' Virtual IP's
    ' Save
    set objFSO2 = CreateObject("Scripting.FileSystemObject")
    strFileName = objFSO2.getAbsolutePathName("") & "\Scan Results.xls"
    objWorkbook.SaveAs(strFileName)
    objWorkbook.Close
    objXLA.Quit
    ' Notify User
    WScript.Echo "Process Completed (" & Now & ")"
    ' Close Program
    WScript.Quit(0)

  • How to run a command line for every folder in a share

    I'm trying to use Robocopy to merge two user home directories shares from two different servers to a new server, but the only problem is that I can't use the /purge to mirror deletes because it will delete the other servers stuff (since one server's stuff
    doesn't exist on the other one currently).
    But I'm thinking if someone I could enumerate the folder names from the users$ share on each server, and add it to both path statements in the commands below, i could add purge since then it would be running individually per user folder, rather than at the
    user level below.
    robocopy "\\CurrentServer1\users$" "F:\Users" /E /B /COPY:DATSOU /R:1 /W:1 /MT /LOG:"C:\RobocopyLogs\MirrorUsers1.txt"
    robocopy "\\CurrentServer2\users$" "F:\Users" /E /B /COPY:DATSOU /R:1 /W:1 /MT /LOG:"C:\RobocopyLogs\MirrorUsers2.txt
    What I'm hoping is that there's some scripting genius out there who could tell me how to use a batch or vbscript to save a LOT of time.  If not, I'm doing this all by hand for hundreds of users :(
    Thanks in advance for any help you can provide.

    Mike and Bill are right on with your approach however, to show you why your code is not working I removed all "Smart Quotes" in favor of the following.
    Refrain from commenting every line.  It makes the script impossible to follow.
    $hostname='hostname'
    $migrationdata='c:\migrate\IPDATA.txt'
    $ip=Select-String -Path C:\migrate\IPDATA.txt -Pattern $hostname
    $ip = $ip.Substring(35)
    $ip = $ip.Trim()
    $dns='10.10.1.10','10.10.1.11'
    $gateway='10.10.4.1'
    $netmask='255.255.252.0'
    $dnsdomain='new.domain.local'
    $msg='We will be using the following information for the new IP stack Hostname:{0}, IP address {1} Default Gateway: {2} DNS Servers: {4} DNS Suffix: {5}'
    Write-Output ($msg -f $hostname,$Ip,$Gateway,$DNS,$DNSdomain)
    $Config=Read-Host 'Please press enter if this is correct, and we will apply this configuration. or CTRL-C to exit'
    #configure the Ip stack
    $Interface = Get-WmiObject win32_networkadapterconfiguration -filter 'IPEnabled=True'
    $Interface.EnableStatic($ip, $netmask)
    $Interface.SetGateways($Gateway, 1)
    $Interface.SetDNSServerSearchOrder($dns)
    $Interface.SetDNSDomain($dnsdomain)
    $Interface.SetDynamicDNSRegistration($true)
    #Show the user the new IP configuration
    ipconfig /allcompartments /all
    $Config = Read-Host 'We have reconfigured the NIC. Does the IP configuration for the "Local Area Connection" look right? Press enter to continue to join the domain, or CTRL-C to exit'
    Use sample white space to make code readable.
    Much of this code does not make sense.  You should be using DHCP to set all workstations and most servers with the exception of Domain Controllers.
    It will be faster to do this with PowerShell since you do not know batch.  Your attempt is not even close.
    ¯\_(ツ)_/¯

  • Unable to launch Litetouch.vbs (LiteTouch.wsf) from UNC path - A connection to the Deploayment Share Could not be made

    I am having a difficult time figuring out this issue. Here is the back story. The particular deployment share is not used in the traditional sense of deploying OS images. Instead, it is only used in deploying applications. I actually have three shares that
    do this catered to three different clientele groups; IT, teachers and students.
    I have these shares set up so that the Litetouch.vbs is used as a login script and tied to specific AD accounts. When launched, it goes through the normal MDT gathering process and eventually shows a list of applications to select to install.
    And this has and still is working perfectly for several years with both wired and wireless computers, until recently.
    My issue, I'm afraid, is with the new Intel Dual Band 7260 wireless cards/drivers (both N7260 and AC7260. The reason I suspect this is because any other desktop or laptop will launch the VBScript just fine and bring up the list of software like it has always
    done. However, if I UNC to the share and try to manually run LiteTouch.vbs, I get the "A connection to the deployment share cannot be made. Connection OK. Possible cause: Invalid credentials." That's right. I can UNC to the shares all day long, but
    when launching the LiteTouch.vbs or LiteTouch.wsf scripts, I always get the above error. So the wireless is working, in a way. Just not the way I need it to. I've tried different versions of drivers all with the same error. I've launched other VBScripts that
    I've wrote from UNC paths and they run fine.
    I am using a Domain Admin account to connect back to the deployment share through MDT. My account is a domain admin account. The share permissions are full control for Everyone and Domain Admins. The folder permissions are Read Only for Everyone and Full
    Control for Domain Admins. Like I stated, this works fine on any other system.
    When I look at the BDD.log file, sometimes I don't see anything, but most of the time I see the line "No physical adapters present. Cannot deploy over wireless." Which, in my case, is not true because I can use any other laptop with older
    Intel wireless cards, Broadcom, Atheros or whatever and it works perfectly. And, if I hardwire the offending laptops and use Ethernet instead of wireless, I can launch the VBScript and proceed just fine.
    I guess my question is, is there a way to force MDT to use any network connection, whether it's wired or wireless to deploy anything. In my case, it would be software.
    We use this option as a way for students in our high schools to be able to log in with a special account and install specific software they may need for a class. It is easier to have them do it this way than to try and install different software for
    different classes on a total of 4000 laptops.
    I am currently running Windows Server 2012 R2 with MDT 2013. The laptops are running Windows 7 SP1 x64 Enterprise and Windows 8.1.1 Enterprise.
    Any help or ideas anyone has to offer would be greatly appreciated.
    ~Mike

    I understand that you got MDT to work on other adapters, and I understand that some people dislike the AC series.
    However...
    I must strongly disagree with your conclusion:
    the Intel 7260 cards just will not work for this scenario. Any other wireless card works
    perfectly fine...
    As designed, MDT is coded to block Wireless deployment scenarios. However, the algorithm used to determine if a network adapter is wired vs wireless is highly flawed, it will check the description (caption) of the network adapter and search for the string:
    "Wireless". And if I recall, it is difficult to determine Wireless vs Wired within a VBSCript.
    Set colAdapters = objWMI.ExecQuery("select * from win32_NetworkAdapterconfiguration where IPEnabled = True")
    For Each oAdapter in colAdapters
    If Instr(UCase(oAdapter.Caption),"WIRELESS") = 0 Then
    If oAdapter.IPConnectionMetric < sIPConnectionMetric Or sIPConnectionMetric = "" Then
    sIPConnectionMetric = oAdapter.IPConnectionMetric
    End If
    End IF
    If Instr(UCase(oAdapter.Caption),"WIRELESS") Then
    sWirelessConnectionMetric = oAdapter.IPConnectionMetric
    End If
    Next
    If sIPConnectionMetric = "" Then
    oLogging.CreateEntry "No physical adapters present, cannot deploy over wireless", LogTypeError
    ValidatenetworkConnectivity = Failure
    Exit Function
    End IF
    On my Lenovo W530, for example, when I disable my Wired connection, my wireless adapter reports:
    PS C:\> gwmi -query "select * from win32_NetworkAdapterconfiguration where IPEnabled = true" | select-object Caption
    Caption
    [00000002] Intel(R) Centrino(R) Ultimate-N 6300 AGN
    AS you can see, no "Wireless" in the caption string.  A connection to the deployment share works just fine.
    Therefore...
    Yes, you *may* have gotten the installation to work on the machines that *just happen* to not have "wireless" in the caption, but I would not count on this to be true on all machines in a corporate environment.
    -k
    Keith Garner - Principal Consultant [owner] -
    http://DeploymentLive.com

  • How do I reinstate the information bar that shows the prevention of opening a pop-up window?

    After Firefox opened the information bar telling me they blocked a pop-up window I inadvertently clicked the option link and deleted the information bar from coming up again.
    How do I reinstate the information bar that shows the prevention of opening a pop-up window?
    == This happened ==
    Just once or twice
    == I clicked the option link and selected the "do not show this again" option

    I set browser.popups.showPopupBlocker to false, and information bar still appears.
    When I also set privacy.popups.showBrowserMessage to false, it doesn't appear.
    To test, whether the information bar appears, I use
    [http://www.popuptest.com/popuptest3.html]
    So, set to true preferences
    privacy.popups.showBrowserMessage
    and
    browser.popups.showPopupBlocker
    Both of them!!!
    Does it help you?

  • I have a script that works with no issues in XP but fails every time in Windows 7

    All the script is supposed to do is get the ip address of the client and add .5 to the last octet passing this ip address through to remote desktop. It performs fine in XP but fails on a join error in 7 or 8. Any help? 
    ' SCRIPT to determine IP address of Terminal Server in Field installation
    ' ASSUMPTIONS: terminal device has been booted after DHCP server
    ' is operational. Calculation of server IP address is based
    ' on terminal device's IP address.
    ' PROCESSING:
    ' Obtain IP Address from Registry (NB: WMI doesn't work...)
    ' Compute server's IP Address by replacing own IP address's
    ' last octet with the number 5
    ' Invoke the TS client in fullscreen mode using the newly
    ' computed address
    ' When done with session, present MSGBOX --  otherwise, the TS
    ' session times out and restarts, leaving a bunch of sessions active
    ' VERSION:1.1
    ' DATE:   September 6, 2007
    ' AUTHOR: Dom
    ' CHANGE LOG
    ' 1.0 Original, using registry hack
    ' 1.1 Modified to use WMI
    ' 1.2 May 2008 - Added msgbox 
    ' 1.3 August 2008 - Translate msgbox
    option explicit ' force all variables to be declared
    ' ***           Start of script                            ***
       Const wbemFlagReturnImmediately = &h10
       Const wbemFlagForwardOnly = &h20
       Dim WshShell, ObjNet
       Dim StrComputer, Server
       Dim objWMIService
       Dim colItems, objItem
       Dim strDefaultIPGateway, strIPAddress, strIPSubnet, cIPAddress
       Set WshShell = WScript.CreateObject("WScript.Shell")
       Set objNet=CreateObject("wscript.Network")
       'Get the Computer's network name
       strComputer=objNet.ComputerName
       ' Connect to root of management interface for this computer
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
       For Each objItem In colItems
          strDefaultIPGateway = Join(objItem.DefaultIPGateway, ",")
          strIPAddress = Join(objItem.IPAddress, ",")
          strIPSubnet = Join(objItem.IPSubnet, ",")
          exit for
       Next
       cIPAddress=split (strIPAddress,".",4)
       Server = cIPAddress(0) & "." & cIPAddress(1) & "." & cIPAddress(2)  & ".5" 
       WshShell.Run "%SystemRoot%\System32\mstsc.exe /v:" & server & " /f",,true
       dim answer
       answer = msgbox ("Click OK to log in to server, Cancel to terminate session" & vbcrlf & "Cliquez OK pour ouvrir une session sur le serveur, ou CANCEL pour fermer la session.",1 + 64 + 4096)
       if answer = 1 then 'that would be "OK"
           wshshell.run "wscript c:\windows\connect.vbs"
       else
          wshShell.run "shutdown -L"
       end if
    '                             END

    After removing all of the lines that do nothing or introduce subtle errors her eis swhat the script actually needs to do.
    ' get local address
    Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True")
    For Each objItem In colItems
    IPAddress = objItem.IPAddress(0)
    Next
    ' fix address
    ip=Split(IPAddress,".")
    ip(3) = 5
    TSServerIP = Join(ip,".")
    ' Run the ssession
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "%SystemRoot%\System32\mstsc.exe /v:" & TSServerIP & " /f",,True
    answer = msgbox ("Click OK to log in to server, Cancel to terminate session" & vbcrlf & "Cliquez OK pour ouvrir une session sur le serveur, ou CANCEL pour fermer la session.",1 + 64 + 4096)
    if answer = 1 then 'that would be "OK"
    wshshell.run "wscript c:\windows\connect.vbs"
    Else
    wshShell.run "shutdown -L"
    end if
    Much shorter and much easier to understand.  Fewer logic errors.
    ¯\_(ツ)_/¯

  • Script to Change WINS IP based on current address.

    Hello everyone! I've been looking online for help on changing the primary and secondary WINS addresses on hundreds of servers. I've come across scripts that will set the WINS addresses for all enabled NICS on servers listed in a .txt file. But I don't want
    it to set WINS address on adapters on our backup network. Long story short, here's what i need:
    PowerShell script that will:
    1. Change the Primary and Secondary WINS addresses on servers from a .txt (or .xlsx) file. 
    2. Makes the change by querying the enabled adapters on the server that already have a specific IP address defined for WINS.
    Here is an example of what I need (I don't know who the original author of this is to give proper credit.) It does what I want for DNS, but need it modified for WINS only. I really appreciate anyone's suggestions!
    #------------begin script-----------------------------
    $ScriptPath        = Split-Path $MyInvocation.MyCommand.Path 
    $oldDNS         = "Enter IP Address Here"        # Old DNS you want replaced
    $newDNS         = "Enter IP Address Here"        # New DNS server you want
    $List             = $ScriptPath + "\list_server.txt"        
    $log             = New-Item -ItemType file -Path $ScriptPath -name change_DNS.csv -Force        
    Add-Content -Path $log -Value "Servers;Status"
    [array]$List = get-content $List 
    for($i=0; $i -lt $List.Length; $i++) 
        $Server =$List[$i]
        Write-Progress -Activity "Modifying DNS records" -Status "Server: $Server"
        $ping = new-object System.Net.NetworkInformation.Ping
        $Reply = $ping.send($Server)
        if ($Reply.status –eq “Success”)
            $colItems = get-wmiobject -class "Win32_NetworkAdapterConfiguration" -namespace "root\cimv2" -computername $Server | Where-Object {$_.IPEnabled -eq "True"}
                foreach ($objItem in $colItems)
                     $strDNSServerSearchOrder = $objItem.DNSServerSearchOrder
                     $dnsexists = $strDNSServerSearchOrder -Contains $oldDNS
                     if ($dnsexists -eq "True")
                        $newArrDNS = $strDNSServerSearchOrder -replace ($oldDNS,$newDNS)
                        $objItem.setDNSServerSearchOrder($newArrDNS) | out-null
                        Add-Content -Path $log -Value "$($Server);A replacement has been made"
                    else {Add-Content -Path $log -Value "$($Server);No Replacement criteria found"}
        else {Add-Content -Path $log -Value "$($Server);Offline or no ping"}
        $Reply = ""
    #------------End script--------------------------

    Yes Bill I did, but didn't find exactly what I was looking for. Oddly enough though, I started searching by "PowerShell Get WINS servers" and I came across something that helped. I ended up using this:
    # here is where I read from the list of servers, this makes the entire list a variable
    $servers = Get-Content C:\Scripts\PS-Scripts\WINS\Test.txt
    Get-wmiObject Win32_networkadapterconfiguration -computername $servers -Filter 'IPEnabled=TRUE and DHCPEnabled=FALSE' | # This filter will make sure the NIC is enabled and DHCP is disabled
    ForEach-Object{ # here is where the list goes through individual objects (or servers)
    IF($_.WINSPrimaryServer -ne $null)
    { # My list shouldn't include any servers with the Primary WINS server set but as a fail-safe this IF statement will catch it if it set
    $_.SetWINSServer("123.123.123.123","123.123.123.123") # If a server has meets all the requirements Here is where I change set the New WINS server address
    From Networksteve.com. It looks like JRV may have originally contributed to the answer on that site, so i'll give him the credit for answering. Thanks both of you for your help!

  • My script doesn't work, any ideas? Help please

    This is my script:
    import-module activedirectory
    $computers = @(Get-ADComputer -Filter * -SearchBase 'OU=Desktop Machines,OU=Computers,OU=MyBusiness,DC=primrose,DC=office')
    $result = @()
    $computers | ForEach-Object { $result += (Get-WmiObject win32_networkadapterconfiguration -ComputerName $_.name | where ($_.ipenabled = 'true') | Select-Object systemname)}
    $result | Export-Csv C:\users\samc\desktop\adapter-test.csv
    $result | out-gridview
    Thanks
    Sam

    Sam, that second script I posted should do that for you.  Use a select-object statement to limit the output to the properties you want to see.
    Here is a list of property names, derived using the get-member cmdlet:
    PSComputerName
    ArpAlwaysSourceRoute
    ArpUseEtherSNAP
    Caption
    DatabasePath
    DeadGWDetectEnabled
    DefaultIPGateway
    DefaultTOS
    DefaultTTL
    Description
    DHCPEnabled
    DHCPLeaseExpires
    DHCPLeaseObtained
    DHCPServer
    DNSDomain
    DNSDomainSuffixSearchOrder
    DNSEnabledForWINSResolution
    DNSHostName
    DNSServerSearchOrder
    DomainDNSRegistrationEnabled
    ForwardBufferMemory
    FullDNSRegistrationEnabled
    GatewayCostMetric
    IGMPLevel
    Index
    InterfaceIndex
    IPAddress
    IPConnectionMetric
    IPEnabled
    IPFilterSecurityEnabled
    IPPortSecurityEnabled
    IPSecPermitIPProtocols
    IPSecPermitTCPPorts
    IPSecPermitUDPPorts
    IPSubnet
    IPUseZeroBroadcast
    IPXAddress
    IPXEnabled
    IPXFrameType
    IPXMediaType
    IPXNetworkNumber
    IPXVirtualNetNumber
    KeepAliveInterval
    KeepAliveTime
    MACAddress
    MTU
    NumForwardPackets
    PMTUBHDetectEnabled
    PMTUDiscoveryEnabled
    ServiceName
    SettingID
    TcpipNetbiosOptions
    TcpMaxConnectRetransmissions
    TcpMaxDataRetransmissions
    TcpNumConnections
    TcpUseRFC1122UrgentPointer
    TcpWindowSize
    WINSEnableLMHostsLookup
    WINSHostLookupFile
    WINSPrimaryServer
    WINSScopeID
    WINSSecondaryServer
    __CLASS
    __DERIVATION
    __DYNASTY
    __GENUS
    __NAMESPACE
    __PATH
    __PROPERTY_COUNT
    __RELPATH
    __SERVER
    __SUPERCLASS
    Hope that helps! Jason

  • Mapping default printer based on AD attribute

    Hi all ! 
    Sorry for my english, i'll try to be clear... :)
    I need to run a VBscript on TSE 2008 R2 servers to set computer's
    default printer (not user). For this, I need to use the ClientName var. 
    The default printer name is written in the computer's description attribute in Active Directory. 
    I'm a beginner in VBscripting. I have parts of scripts working, but not everything.
    Here is my script (my comments are written with ''''''''''''''''''''''''''''''''''''''''''''): 
    'find clientname
    strComputer = "."
    Const ForAppending = 8
    Set oNetwork = wscript.CreateObject("wscript.network") 'Create network object
    Set objShell = Wscript.CreateObject("Wscript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    strUserName  = oNetwork.userName
    strComputerName  = oNetwork.computerName
    strClientName = objShell.ExpandEnvironmentStrings("%clientname%")
    ExecuteSearch = SearchDistinguishedName(strClientName)
    Public Function SearchDistinguishedName(ByVal vSAN)
    Const ADS_SCOPE_SUBTREE = 2
        Dim oRootDSE, oConnection, oCommand, oRecordSet
        Set oRootDSE = GetObject("LDAP://rootDSE")
        Set oConnection = CreateObject("ADODB.Connection")
        oConnection.Open "Provider=ADsDSOObject;"
        Set objCommand = CreateObject("ADODB.Command")
        objCommand.ActiveConnection = oConnection
    ldstring = "'LDAP://" & oRootDSE.get("defaultNamingContext") & "'" 
    objCommand.CommandText = "Select Name, distinguishedName from "& ldstring & " where objectClass='computer'"  
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Timeout") = 30 
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    objCommand.Properties("Cache Results") = False 
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
    Do Until objRecordSet.EOF
    If lcase(objRecordSet.Fields("Name").Value) = lcase(vSan) Then
        Wscript.Echo "Client Name: " & objRecordSet.Fields("Name").Value & vbCrLf _ 
        & "Location: " & objRecordSet.Fields("distinguishedName").Value
        'Wscript.Quit
    End If
        objRecordSet.MoveNext
    Loop
    End Function
    ' find canonical name
    On Error Resume Next
    ADSRoot = "DC=domain,DC=fr"
    Const ADS_SCOPE_SUBTREE = 2
    Set objConnection2 = CreateObject("ADODB.Connection")
    Set objCommand2 = CreateObject("ADODB.Command")
    objConnection2.Provider = "ADsDSOObject"
    objConnection2.Open "Active Directory Provider"
    Set objCommand2.ActiveConnection = objConnection2
    objCommand2.Properties("Page Size") = 1000
    objCommand2.Properties("Searchscope") = ADS_SCOPE_SUBTREE
    objCommand2.CommandText = _
    "SELECT * FROM 'LDAP://" & ADSRoot & "' WHERE objectCategory='user' OR objectCategory='computer'"
    ''''''''''''''''''''''''''''''''''''Here, I use a input box to enter the clientname, cause I don't know how to re-use the clientname found in the lasts vars.
    srchTrm = LCase(InputBox("Please enter your search term.", "Active Directory Search"))
    WScript.Echo srchTrm
    i = 0
    If Len(srchTrm) < 4 or Instr(srchTrm, "=") Then
    WScript.Echo "Please enter a search term in excess of 3 characters. Don't use ""="""
    WScript.Quit
    End If
    Set objRecordSet2 = objCommand2.Execute
    objRecordSet2.MoveFirst
    Do Until objRecordSet2.EOF
    strADPath = LCase(objRecordSet2.Fields("adsPath").Value)
    If InStr(strADPath, srchTrm) Then
    Set objUser = GetObject(objRecordSet2.Fields("adsPath").Value)
    Select Case objUser.Class
    Case "user"
    strMsg = "Type: Person" & VbCrLf
    strMsg = strMsg & "Name: " & objUser.DisplayName & VbCrLf
    strMsg = strMsg & "Email: " & objUser.mail & VbCrLf
    strMsg = strMsg & "Telephone: " & objUser.telephoneNumber & VbCrLf
    strMsg = strMsg & "Department: " & objUser.department & VbCrLf
    strMsg = strMsg & "Title: " & objUser.title & VbCrLf
    Case "computer"
    strMsg = "Type: Computer" & VbCrLf
    strMsg = strMsg & "Name: " & objUser.Get("name") & VbCrLf
    strMsg = strMsg & "OS: " & objUser.operatingSystem & VbCrLf
    Case Else
    strMsg = "Unidentified" & VbCrLf
    End Select
    'strMsg = strMsg & "LDAP: " & objUser.adsPath & VbCrLf
    objUser.GetInfoEx Array("canonicalName"), 0
    strMsg = strMsg & "AD Path: " & objUser.canonicalName & VbCrLf
    objUser.GetInfoEx Array("description"), 0
    strMsg = strMsg & "Imprimante: " & objUser.description
    WScript.Echo strMsg & VbCrLf
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Here I want to use the "objuser.description" to set default printer
    Dim WshNetwork
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.SetDefaultPrinter "\\SRV-PRINT.domain.fr\" & objUser.description
    i = i + 1
    End If
    objRecordSet2.MoveNext
    Loop
    If Not i > 0 Then
    WScript.Echo "No results found."
    End If
    I think there's a most simple way to do this, but for the moment, I Don't know how to do. 
    Any help would be grateful. 

    Hello. 
    We need to do this because each computer in the office as a network printer (or nearly each computer). I can't do a Group Policy for each computer in my domain. We cannot work with users accounts, only computers . 
    My problem is that if the user1 is connected on Comp1, he must have the printer near computer 1 as default printer.
    If user1 is connected on computer 2, at the other side of the office, he must have the printer near computer 2. So I cannot imagine a group policy to do this :). 
    We had the idea to use the descprition attribute in Active Directory to indicate the default printer to map.
    We must now make a script to get clientname on the TSE session, look for the computer account in Active Directory, read its description's attibute and map the default printer. 
    For example, my computer is COMP01. I use a TSE environment on SRVTSE01. 
    The script need to determine which computer (COMP01) is connected to the SRVTSE01 server (clientname var), search Active Directory computer account of COMP01, read the account's description attribute (for example PRINT01) and set \\SRV-PRINT\PRINT01 as the
    default printer on COMP01.
    Hope it's better with this example... 

  • Boot from Media and static IP script

    I thought I would give back a bit to the community.  My current engagement has a client where 2/3 of the computers are not on DHCP, and probably won't be anytime soon.  There is a feature deficiency in the SCCM boot from media function, it lets
    you set the IP address in the initial WinPE startup, but that address isn't communicated to Windows.  Windows comes up expecting to find DHCP.  Hint, hint here anyone from the product group, this should be added to the Apply Network Settings task
    This script needs to be put in the task sequence right before the Apply Network Settings task sequence step.  The script will check to see if the variables were already set in Windows (which works correctly).  If not (only happens when you are
    doing a new install) it will read the entries from WinPE and write them to the TS variables needed by Apply Network Settings. 
    There is a limitation to the scipt that it can only put in as much as can be entered by WinPE.  So things like multiple DNS servers for example can't be entered into PE, so they can't be transfered to Windows.
    Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
    WQL = "Select * from Win32_NetworkAdapterConfiguration where IPEnabled = TRUE"
    Set colNetAdapters = objWMIService.ExecQuery (WQL)
    WScript.Echo "Number of adapters is " & colNetAdapters.Count
    set objSCCM = CreateObject("Microsoft.SMS.TSEnvironment")
    if objSCCM("OSDAdapter0IPAddressList") = "" then
     For Each objNetAdapter In colNetAdapters
      if objNetAdapter.DHCPEnabled then
       WScript.Echo "DHCP Enabled"
      else
       WScript.Echo "DHCP Disabled"
       objSCCM("OSDAdapter0EnableDHCP") = false
       if Not IsNull (objNetAdapter.IPAddress) then
        strIPAddress = objNetAdapter.IPAddress(0)
        WScript.Echo "IP Address:       " & strIPAddress
        objSCCM("OSDAdapter0IPAddressList") = strIPAddress
       end if
       if Not IsNull (objNetAdapter.IPSubnet) then
        strIPSubnet = objNetAdapter.IPSubnet(0)
        WScript.Echo "IP Subnet:        " & strIPSubnet
        objSCCM("OSDAdapter0SubnetMask") = strIPSubnet
       end if
       if Not IsNull (objNetAdapter.DefaultIPGateway) then
        strIPGateway = objNetAdapter.DefaultIPGateway(0)
        WScript.Echo "IP Gateway:       " & strIPGateway
        objSCCM("OSDAdapter0Gateways") = strIPGateway
       end if
       if Not IsNull (objNetAdapter.DNSServerSearchOrder) then
        strDNSServerSearchOrder = objNetAdapter.DNSServerSearchOrder(0)
        WScript.Echo "DNS Server:       " & strDNSServerSearchOrder
        objSCCM("OSDAdapter0DNSServerList") = strDNSServerSearchOrder
       end if
       if Not IsNull (objNetAdapter.MACAddress) then
        strMACAddress = objNetAdapter.MACAddress(0)
        WScript.Echo "MAC Address:      " & strMACAddress
       end if
       if Not IsNull (objNetAdapter.DNSDomainSuffixSearchOrder) then
        strDNSDomainSuffixSearchOrder = objNetAdapter.DNSDomainSuffixSearchOrder(0)
        WScript.Echo "DNS DOMAIN:       " & strDNSDomainSuffixSearchOrder
       end if
       if Not IsNull (objNetAdapter.WINSPrimaryServer) then
        strWins = objNetAdapter.WINSPrimaryServer
        objSCCM("OSDAdapter0EnableWINS") = true
        if Not IsNull (objNetAdapter.WINSSecondaryServer) then
         strWins = strWins & "," & objNetAdapter.WINSSecondaryServer
        end if
        WSCript.Echo "WINS Server:      " & strWins
        objSCCM("OSDAdapter0WINSServerList") = strWins
       else
        objSCCM("OSDAdapter0EnableWINS") = false
       end if
       objSCCM("OSDAdapterCount") = 1
      end if
     Next
    End If
    Bob

    Here is a new version of the script, I think it has a few tweaks in it, it's been a while.  But I don't think it will solve your problem, neither will setting the variable in the collection.  Try this, it might help, run the script as cscript StaticIPBoot
    and look at the output, it might give you some clue as to what's going on, or better yet change the script in the task sequence to:
    cscript StaticIPBoot.vbs > c:\ip.txt
    The script is fairly verbose, it might give you an idea of why it's not working.  The only reason I can see for that variable to be zero is that the script isn't finding any network adapters, or DHCP is enabled.
    Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
    WQL = "Select * from Win32_NetworkAdapterConfiguration where IPEnabled = TRUE"
    Set colNetAdapters = objWMIService.ExecQuery (WQL)
    WScript.Echo "Number of adapters is " & colNetAdapters.Count
    set objSCCM = CreateObject("Microsoft.SMS.TSEnvironment")
    if objSCCM("OSDAdapter0IPAddressList") = "" then
     For Each objNetAdapter In colNetAdapters
      if objNetAdapter.DHCPEnabled then
       WScript.Echo "DHCP Enabled"
      else
       WScript.Echo "DHCP Disabled"
       objSCCM("OSDAdapter0EnableDHCP") = "false"
       if Not IsNull (objNetAdapter.IPAddress) then
        strIPAddress = objNetAdapter.IPAddress(0)
        WScript.Echo "IP Address:       " & strIPAddress
        objSCCM("OSDAdapter0IPAddressList") = strIPAddress
       end if
       if Not IsNull (objNetAdapter.IPSubnet) then
        strIPSubnet = objNetAdapter.IPSubnet(0)
        WScript.Echo "IP Subnet:        " & strIPSubnet
        objSCCM("OSDAdapter0SubnetMask") = strIPSubnet
       end if
       if Not IsNull (objNetAdapter.DefaultIPGateway) then
        strIPGateway = objNetAdapter.DefaultIPGateway(0)
        WScript.Echo "IP Gateway:       " & strIPGateway
        objSCCM("OSDAdapter0Gateways") = strIPGateway
       end if
       if Not IsNull (objNetAdapter.DNSServerSearchOrder) then
        strDNSServerSearchOrder = objNetAdapter.DNSServerSearchOrder(0)
        WScript.Echo "DNS Server:       " & strDNSServerSearchOrder
        objSCCM("OSDAdapter0DNSServerList") = strDNSServerSearchOrder
       end if
       if Not IsNull (objNetAdapter.MACAddress) then
        strMACAddress = objNetAdapter.MACAddress(0)
        WScript.Echo "MAC Address:      " & strMACAddress
       end if
       if Not IsNull (objNetAdapter.DNSDomainSuffixSearchOrder) then
        strDNSDomainSuffixSearchOrder = objNetAdapter.DNSDomainSuffixSearchOrder(0)
        WScript.Echo "DNS DOMAIN:       " & strDNSDomainSuffixSearchOrder
       end if
       if Not IsNull (objNetAdapter.WINSPrimaryServer) then
        strWins = objNetAdapter.WINSPrimaryServer
        objSCCM("OSDAdapter0EnableWINS") = "true"
        if Not IsNull (objNetAdapter.WINSSecondaryServer) then
         strWins = strWins & "," & objNetAdapter.WINSSecondaryServer
        end if
        WSCript.Echo "WINS Server:      " & strWins
        objSCCM("OSDAdapter0WINSServerList") = strWins
       else
        objSCCM("OSDAdapter0EnableWINS") = "false"
       end if
       objSCCM("OSDAdapterCount") = "1"
      end if
     Next
    End If
    Bob

  • PS Script to Automate NIC Teaming and Configure Static IP Address based off an Existing Physical NIC

    # Retrieve IP Address and Default Gateway from static IP Assigned NIC and assign to variables.
    $wmi = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "IPEnabled = True" |
    Where-Object { $_.IPAddress -match '192\.' }
    $IPAddress = $wmi.IpAddress[0]
    $DefaultGateway = $wmi.DefaultIPGateway[0]
    # Create Lbfo TEAM1, by binding “Ethernet” and “Ethernet 2” NICs.
    New-NetLbfoTeam -Name TEAM1 -TeamMembers "Ethernet","Ethernet 2" -TeamingMode Lacp -LoadBalancingAlgorithm TransportPorts -Confirm:$false
    # 20 second pause to allow TEAM1 to form and come online.
    Start-Sleep -s 20
    # Configure static IP Address, Subnet, Default Gateway, DNS Server IPs to newly formed TEAM1 interface.
    New-NetIPAddress –InterfaceAlias “TEAM1” –IPAddress $IPAddress –PrefixLength 24 -DefaultGateway $DefaultGateway
    Set-DnsClientServerAddress -InterfaceAlias “TEAM1” -ServerAddresses xx.xx.xx.xx, xx.xx.xx.xx
    Howdy All!
    I was recently presented with the challenge of automating the creation and configuration of a NIC Team on Server 2012 and Server 2012 R2.
    Condition:
    New Team will use static IP Address of an existing NIC (one of two physical NICs to be used in the Team).  Each server has more than one NIC.
    Our environment is pretty static, in the sense that all our servers use the same subnet mask and DNS server IP Addresses, so I really only had
    to worry about the Static IP Address and the Default Gateway.
    1. Retrieve NIC IP Address and Default Gateway:
    I needed a way to query only the NIC with the correct IP Address settings and create required variables based on that query.  For that, I
    leveraged WMI.  For example purposes, let's say the servers in your environment start with 192. and you know the source physical NIC with desired network configurations follows this scheme.  This will retrieve only the network configuration information
    for the NIC that has the IP Address that starts with "192."  Feel free to replace 192 with whatever octet you use.  you can expand the criteria by filling out additional octects... example:
    Where-Object
    $_.IPAddress
    -match'192\.168.' } This would search for NICs with IP Addresses 192.168.xx.xx.
    $wmi
    = Get-WmiObject
    Win32_NetworkAdapterConfiguration
    -Filter "IPEnabled = True"
    |
    Where-Object {
    $_.IPAddress
    -match '192\.' }
    $IPAddress
    = $wmi.IpAddress[0]
    $DefaultGateway
    = $wmi.DefaultIPGateway[0]
    2. Create Lbfo TEAM1
    This is a straight forward command based off of New-NetLbfoTeam.  I used  "-Confirm:$false" to suppress prompts. 
    Our NICs are named “Ethernet” and “Ethernet 2” by default, so I was able to keep –TeamMembers as a static entry. 
    Also added start-sleep command to give the new Team time to build and come online before moving on to network configurations. 
    New-NetLbfoTeam
    -Name TEAM1
    -TeamMembers "Ethernet","Ethernet 2"
    -TeamingMode SwitchIndependent
    -LoadBalancingAlgorithm
    Dynamic -Confirm:$false
    # 20 second pause to allow TEAM1 to form and come online.
    Start-Sleep
    -s 20
    3. Configure network settings for interface "TEAM1".
    Now it's time to pipe the previous physical NICs configurations to the newly built team.  Here is where I will leverage
    the variables I created earlier.
    There are two separate commands used to fully configure network settings,
    New-NetIPAddress : Here is where you assign the IP Address, Subnet Mask, and Default Gateway.
    Set-DnsClientServerAddress: Here is where you assign any DNS Servers.  In my case, I have 2, just replace x's with your
    desired DNS IP Addresses.
    New-NetIPAddress
    –InterfaceAlias “TEAM1”
    –IPAddress $IPAddress
    –PrefixLength 24
    -DefaultGateway $DefaultGateway
    Set-DnsClientServerAddress
    -InterfaceAlias “TEAM1”
    -ServerAddresses xx.xx.xx.xx, xx.xx.xx.xx
    Hope this helps and cheers!

    I've done this before, and because of that I've run into something you may find valuable. 
    Namely two challenges:
    There are "n" number of adapters in the server.
    Adapters with multiple ports should be labeled in order.
    MS only supports making a LBFO Team out of "like speed" adapters.
    To solve both of these challenges I standardized the name based on link speed for each adapter before creating hte team.  Pretty simple really!  FIrst I created to variables to store the 10g and 1g adapters.  I went ahead and told it to skip
    any "hyper-V" ports for obvious reasons, and sorted by MAC address as servers tend to put all thier onboard NICs in sequentially by MAC:
    $All10GAdapters = (Get-NetAdapter |where{$_.LinkSpeed -eq "10 Gbps" -and $_.InterfaceDesription -notmatch 'Hyper-V*'}|sort-object MacAddress)
    $All1GAdapters = (Get-NetAdapter |where{$_.LinkSpeed -eq "1 Gbps" -and $_.InterfaceDesription -notmatch 'Hyper-V*'}|sort-object MacAddress)
    Sweet ... now that I have my adapters I can rename them into something standardized:
    $i=0
    $All10GAdapters | ForEach-Object {
    Rename-NetAdapter -Name $_.Name -NewName "Ethernet_10g_$i"
    $i++
    $i = 0
    $All1GAdapters | ForEach-Object {
    Rename-NetAdapter -Name $_.Name -NewName "Ethernet_1g_$i"
    $i++
    Once that's done Now i can return to your team command but use a wildcard sense I know the standardized name!
    New-NetLbfoTeam -Name TEAM1G -TeamMembers Ethernet_1g_* -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic -Confirm:$false
    New-NetLbfoTeam -Name TEAM10G -TeamMembers Ethernet_10g_* -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic -Confirm:$false

  • WMIC Output not displaying all fields

    I am running some audits to get hostname, ip and macaddress for a large number of machines.  My plan is to run these commands  and typing out the file. the problem lies in the second command is not getting inputted into the file and I am not sure
    why.
    wmic computersystem get name
    wmic nic where netenabled=true get netconnectionID 
    wmic /output:C:\RDFD\wmictest.csv nicconfig where IPEnabled=True get ipaddress, macaddress /format:csv
    My output looks like this, data is there I have removed personal info. 
    Node,IPAddress,MACAddress
    hostname,{IPV4;IPV6},MACaddress
    So my question is why is the netconnectionID not getting inputted into the file?  Running the command by itself yields a good result. As a secondary question, is it possible to remove the header from the file? Right now I am for lopping it with this
    as there is a blank line before the header too.
    for /F "Skip=2 tokens=*" %a in ('Type c:\wmictest.csv') do @echo %a

    Hi Rougeherring,
     >>We hope to get hostname, interface name, macaddress into a nice comsumable format.
    If you want to achieve above with cmd, I think it's difficult, because  netconnectionID and macaddress are from different commands. If we need to combine all the results to one csv file we need to use append. however, the
    properties from different commands are different, so the header of the output is broken.
    I think using command is hard to keep the nice format.
    Conversely,When using Get-WmiObject in Windows Powershell to connect to a remote computer, The remote system does not need to have Windows PowerShell installed. This allows you to administer operating systems that are not running Windows PowerShell,
    but do have WMI available.
    $nic = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName "remotecomputername" -Filter IPEnabled=TRUE| Foreach-Object{
    $nac = @($_.GetRelated('Win32_NetworkAdapter'))[0]
    New-Object PSObject -Property @{
    Node = $_.PSComputerName
    MACaddress = $nac.MACAddress
    IPAddress = ($_.IPAddress -join ', ')
    NetconnectionID = $nac.NetconnectionID
    $nic|Export-Csv d:\test1\wmi.csv -NoTypeInformation
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Default software inventory not collecting any data from client

    Hi Team,
    I have enabled software inventory in global level and set it to weekly once .. But during the Software inventory scan , it is not capturing anything and Software scan date is showing as null ...
    The below settings are enabled for my software inventory :
    1) Enable Software inventory on Client = Yes
    2) Schedule software inventory = Weekly once
    3) Inventory report details = Full details
    4) Inventory these file types = (none)
    5) Collect Files = (none)
    I am getting the below information from Client log (InventoryAgent.log)
    Inventory: Message type is InventoryAction InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Temp directory = C:\Windows\CCM\Inventory\Temp\ InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Clearing old collected files. InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Opening store for action {00000000-0000-0000-0000-000000000002} ... InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    InventoryVersionNumber for '{00000000-0000-0000-0000-000000000002}' not found. InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    CInvState::VerifyInventoryVersionNumber: Couldn't get version number for '{00000000-0000-0000-0000-000000000002}': 80070490 InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Delta report without a previous Full report; will do a Full report. InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Action=Software, ReportType=Full, MajorVersion=1, MinorVersion=0 InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Initialization completed in 0.125 seconds InventoryAgent 19/04/2013 13:21:38 4200 (0x1068)
    Inventory: Collection Task completed in 1.014 seconds InventoryAgent 19/04/2013 13:21:39 4200 (0x1068)
    Inventory: Temp report = C:\Windows\CCM\Inventory\Temp\f8e432b2-be58-4730-a69f-b17ead9b69ff.xml InventoryAgent 19/04/2013 13:21:39 4200 (0x1068)
    Collection: 0/0 inventory data items successfully inventoried. InventoryAgent 19/04/2013 13:21:39 4200 (0x1068)
    Inventory: Starting reporting task. InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Reporting: 0 report entries created. InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Inventory: Reporting Task completed in 0.016 seconds InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Inventory: No data items to collect and report is empty. No report will be sent. InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Inventory: Cycle completed in 1.155 seconds InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Inventory: Action completed. InventoryAgent 19/04/2013 13:21:39 1180 (0x049C)
    Thanks,
    Raja S
    Raja

    Here is the log details.  I also reimaged this machine fresh.  It is as clean as can be.  Thanks for the look over.  never had this issue with 2007.  Again, I am building some collections based on this .flg file which is 0KB.
    <![LOG[Inventory: *********************** Start of message processing. ***********************]LOG]!><time="14:06:01.186+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:322">
    <![LOG[Inventory: Message type is SiteChange]LOG]!><time="14:06:01.187+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:323">
    <![LOG[Inventory: Clearing Action Status]LOG]!><time="14:06:01.187+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:706">
    <![LOG[Inventory: ************************ End of message processing. ************************]LOG]!><time="14:06:01.210+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:409">
    <![LOG[Inventory: *********************** Start of message processing. ***********************]LOG]!><time="14:06:01.210+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:322">
    <![LOG[Inventory: Message type is InventoryAction]LOG]!><time="14:06:01.210+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentendpoint.cpp:323">
    <![LOG[Inventory: Temp directory = C:\WINDOWS\CCM\Inventory\Temp\]LOG]!><time="14:06:01.211+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentstate.cpp:2727">
    <![LOG[Inventory: Clearing old collected files.]LOG]!><time="14:06:01.211+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentstate.cpp:1812">
    <![LOG[Inventory: Opening store for action {00000000-0000-0000-0000-000000000003} ...]LOG]!><time="14:06:01.217+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="datastore.cpp:176">
    <![LOG[InventoryVersionNumber for '{00000000-0000-0000-0000-000000000003}' not found.]LOG]!><time="14:06:01.222+420" date="02-04-2014" component="InventoryAgent" context="" type="2" thread="5860" file="clientstate.cpp:127">
    <![LOG[CInvState::VerifyInventoryVersionNumber: Couldn't get version number for '{00000000-0000-0000-0000-000000000003}': 80070490]LOG]!><time="14:06:01.226+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentstate.cpp:1484">
    <![LOG[Inventory: Action=Discovery, ReportType=Full, MajorVersion=1, MinorVersion=0]LOG]!><time="14:06:01.230+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentstate.cpp:1681">
    <![LOG[Inventory: Initialization completed in 0.015 seconds]LOG]!><time="14:06:01.230+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5860" file="agentstate.cpp:526">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, PlatformID FROM CCM_DiscoveryData; Timeout = 600 secs.]LOG]!><time="14:06:01.239+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Signing turned off. Skipping query SELECT __CLASS, __PATH, __RELPATH, EncodedSigningPublicKey FROM CCM_ClientSecurityInformation; ]LOG]!><time="14:06:01.249+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476"
    file="collectiontask.cpp:460">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, FQDN FROM CCM_ExtNetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:06:01.249+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, SystemOUName FROM CCM_SystemOU; Timeout = 600 secs.]LOG]!><time="14:06:01.261+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, ClientIdChangeDate, PreviousClientId FROM CCM_Client; Timeout = 600 secs.]LOG]!><time="14:06:01.328+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, ADSiteName FROM CCM_ADSiteInfo; Timeout = 600 secs.]LOG]!><time="14:06:01.342+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, IPAddress, MACAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE; Timeout = 600 secs.]LOG]!><time="14:06:01.357+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, UserName FROM Win32_ComputerSystem; Timeout = 600 secs.]LOG]!><time="14:06:01.412+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPv6Address FROM CCM_IPv6NetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:06:01.435+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPSubnet FROM CCM_NetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:06:01.454+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, Name FROM SMS_Authority; Timeout = 600 secs.]LOG]!><time="14:06:01.489+420" date="02-04-2014" component="InventoryAgent" context=""
    type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IsWriteFilterCapable, IsPortableOS, AgentEdition, IsAOACCapable FROM CCM_OperatingSystem; Timeout = 600 secs.]LOG]!><time="14:06:01.496+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccmvdi; Query = SELECT __CLASS, __PATH, __RELPATH, IsAssignedToUser, IsMachineChangesPersisted, IsVirtual, HostIdentifier FROM CCM_DesktopMachine; Timeout = 600 secs.]LOG]!><time="14:06:01.512+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPv6Prefix FROM CCM_IPv6PrefixNetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:06:01.546+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, UUID FROM Win32_ComputerSystemProduct; Timeout = 600 secs.]LOG]!><time="14:06:01.569+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, Domain FROM CCM_ComputerSystem; Timeout = 600 secs.]LOG]!><time="14:06:01.578+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, HardwareID1 FROM CCM_ClientIdentificationInformation; Timeout = 600 secs.]LOG]!><time="14:06:01.586+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2\sms; Query = SELECT __CLASS, __PATH, __RELPATH, Description FROM SMS_Processor; Timeout = 600 secs.]LOG]!><time="14:06:01.592+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="6476" file="collectiontask.cpp:478">
    <![LOG[Collection: 17/18 inventory data items successfully inventoried.]LOG]!><time="14:06:02.716+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="collectiontask.cpp:276">
    <![LOG[Inventory: Collection Task completed in 1.498 seconds]LOG]!><time="14:06:02.716+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="agentstate.cpp:883">
    <![LOG[Inventory: 1 Collection Task(s) failed.]LOG]!><time="14:06:02.716+420" date="02-04-2014" component="InventoryAgent" context="" type="2" thread="6476" file="agentstate.cpp:897">
    <![LOG[Inventory: Temp report = C:\WINDOWS\CCM\Inventory\Temp\0a9e7fb9-8ae2-4df1-a5ee-2c1367ac00c2.xml]LOG]!><time="14:06:02.719+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="6476" file="agentstate.cpp:2360">
    <![LOG[Inventory: Starting reporting task.]LOG]!><time="14:06:02.719+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="reporttask.cpp:240">
    <![LOG[Reporting: 17 report entries created.]LOG]!><time="14:06:02.729+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="reporttask.cpp:260">
    <![LOG[Inventory: Reporting Task completed in 0.000 seconds]LOG]!><time="14:06:02.729+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="agentstate.cpp:950">
    <![LOG[Inventory: Successfully sent report. Destination:mp:MP_DdrEndpoint, ID: {E3C74321-93D7-44B2-872D-0D8B0209B59A}, Timeout: 80640 minutes MsgMode: Signed, Not Encrypted]LOG]!><time="14:06:02.743+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="5492" file="agentstate.cpp:2252">
    <![LOG[Inventory: Cycle completed in 1.606 seconds]LOG]!><time="14:06:02.815+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="agentstate.cpp:1736">
    <![LOG[Inventory: Action completed.]LOG]!><time="14:06:02.815+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="agentstate.cpp:1746">
    <![LOG[Inventory: ************************ End of message processing. ************************]LOG]!><time="14:06:02.815+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="5492" file="agentendpoint.cpp:409">
    <![LOG[Inventory: *********************** Start of message processing. ***********************]LOG]!><time="14:10:17.652+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentendpoint.cpp:322">
    <![LOG[Inventory: Message type is InventoryAction]LOG]!><time="14:10:17.667+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentendpoint.cpp:323">
    <![LOG[Inventory: Temp directory = C:\WINDOWS\CCM\Inventory\Temp\]LOG]!><time="14:10:17.667+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentstate.cpp:2727">
    <![LOG[Inventory: Clearing old collected files.]LOG]!><time="14:10:17.667+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentstate.cpp:1812">
    <![LOG[Inventory: Opening store for action {00000000-0000-0000-0000-000000000003} ...]LOG]!><time="14:10:17.683+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="datastore.cpp:176">
    <![LOG[Inventory: Action=Discovery, ReportType=Full, MajorVersion=2, MinorVersion=0]LOG]!><time="14:10:18.245+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentstate.cpp:1681">
    <![LOG[Inventory: Initialization completed in 0.577 seconds]LOG]!><time="14:10:18.245+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4192" file="agentstate.cpp:526">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, PlatformID FROM CCM_DiscoveryData; Timeout = 600 secs.]LOG]!><time="14:10:18.261+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Signing turned off. Skipping query SELECT __CLASS, __PATH, __RELPATH, EncodedSigningPublicKey FROM CCM_ClientSecurityInformation; ]LOG]!><time="14:10:18.276+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276"
    file="collectiontask.cpp:460">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, FQDN FROM CCM_ExtNetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:10:18.276+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, SystemOUName FROM CCM_SystemOU; Timeout = 600 secs.]LOG]!><time="14:10:18.276+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, ClientIdChangeDate, PreviousClientId FROM CCM_Client; Timeout = 600 secs.]LOG]!><time="14:10:18.339+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, ADSiteName FROM CCM_ADSiteInfo; Timeout = 600 secs.]LOG]!><time="14:10:18.339+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, IPAddress, MACAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE; Timeout = 600 secs.]LOG]!><time="14:10:18.354+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, UserName FROM Win32_ComputerSystem; Timeout = 600 secs.]LOG]!><time="14:10:18.386+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPv6Address FROM CCM_IPv6NetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:10:18.386+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPSubnet FROM CCM_NetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:10:18.401+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, Name FROM SMS_Authority; Timeout = 600 secs.]LOG]!><time="14:10:18.432+420" date="02-04-2014" component="InventoryAgent" context=""
    type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IsWriteFilterCapable, IsPortableOS, AgentEdition, IsAOACCapable FROM CCM_OperatingSystem; Timeout = 600 secs.]LOG]!><time="14:10:18.432+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccmvdi; Query = SELECT __CLASS, __PATH, __RELPATH, IsAssignedToUser, IsMachineChangesPersisted, IsVirtual, HostIdentifier FROM CCM_DesktopMachine; Timeout = 600 secs.]LOG]!><time="14:10:18.448+420"
    date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, IPv6Prefix FROM CCM_IPv6PrefixNetworkAdapterConfiguration; Timeout = 600 secs.]LOG]!><time="14:10:18.479+420" date="02-04-2014"
    component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, UUID FROM Win32_ComputerSystemProduct; Timeout = 600 secs.]LOG]!><time="14:10:18.479+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm\invagt; Query = SELECT __CLASS, __PATH, __RELPATH, Domain FROM CCM_ComputerSystem; Timeout = 600 secs.]LOG]!><time="14:10:18.495+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\ccm; Query = SELECT __CLASS, __PATH, __RELPATH, HardwareID1 FROM CCM_ClientIdentificationInformation; Timeout = 600 secs.]LOG]!><time="14:10:18.510+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: Namespace = \\.\root\cimv2\sms; Query = SELECT __CLASS, __PATH, __RELPATH, Description FROM SMS_Processor; Timeout = 600 secs.]LOG]!><time="14:10:18.510+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="3276" file="collectiontask.cpp:478">
    <![LOG[Collection: 17/18 inventory data items successfully inventoried.]LOG]!><time="14:10:19.603+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="collectiontask.cpp:276">
    <![LOG[Inventory: Collection Task completed in 1.342 seconds]LOG]!><time="14:10:19.603+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="agentstate.cpp:883">
    <![LOG[Inventory: 1 Collection Task(s) failed.]LOG]!><time="14:10:19.603+420" date="02-04-2014" component="InventoryAgent" context="" type="2" thread="3276" file="agentstate.cpp:897">
    <![LOG[Inventory: Temp report = C:\WINDOWS\CCM\Inventory\Temp\ffc7f473-3fa5-4101-954b-7160c4aab394.xml]LOG]!><time="14:10:19.619+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="3276" file="agentstate.cpp:2360">
    <![LOG[Inventory: Starting reporting task.]LOG]!><time="14:10:19.619+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="reporttask.cpp:240">
    <![LOG[Reporting: 17 report entries created.]LOG]!><time="14:10:19.635+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="reporttask.cpp:260">
    <![LOG[Inventory: Reporting Task completed in 0.015 seconds]LOG]!><time="14:10:19.635+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="agentstate.cpp:950">
    <![LOG[Inventory: Successfully sent report. Destination:mp:MP_DdrEndpoint, ID: {E1A25E8B-53B4-429F-927C-C1EACCC93B70}, Timeout: 80640 minutes MsgMode: Signed, Not Encrypted]LOG]!><time="14:10:19.666+420" date="02-04-2014" component="InventoryAgent"
    context="" type="1" thread="4080" file="agentstate.cpp:2252">
    <![LOG[Inventory: Cycle completed in 2.542 seconds]LOG]!><time="14:10:20.212+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="agentstate.cpp:1736">
    <![LOG[Inventory: Action completed.]LOG]!><time="14:10:20.212+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="agentstate.cpp:1746">
    <![LOG[Inventory: ************************ End of message processing. ************************]LOG]!><time="14:10:20.212+420" date="02-04-2014" component="InventoryAgent" context="" type="1" thread="4080" file="agentendpoint.cpp:409">

  • Configure DNS Setting via Powershell

    Hi,
    I am trying to get a script together that will configure a static IP address, DNS, and WINS server settings. The instructions here are great, except the DNS part doesn't work.
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/28/use-powershell-to-configure-static-ip-and-dns-settings.aspx
    Here are the commands in the script:
    $wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
    $wmi.EnableStatic("192.168.1.2", "255.255.255.0")
    $wmi.SetGateways("192.168.1.1", 1)
    $wmi.SetDNSServerSearchOrder("208.67.220.220", "208.67.222.222", "8.8.8.8")
    $wmi.SetWINSServer("192,168,1,1")
    Each time I run the script it fails on the DNS portion. I am doing this on Windows Server 2012. The specific error message is: Cannot find an overload for "SetDNSServerSearchOrder" and the argument count: "3".
    Any ideas? Thanks
    Jason Watkins MCSE, MCSA, MCDBA, CCNA

    Hi N74JW,
    What is your current situation?
    If issue insists, you may take a try to save the DNS Server into a variable, see:
    $dnsSearchOrder = "208.67.220.220", "208.67.222.222", "8.8.8.8"
    $wmi.SetDNSServerSearchOrder($dnsSearchOrder )
    Then check if issue could be solved.
    Best regards
    Michael Shao
    TechNet Community Support

Maybe you are looking for