Link to home
Start Free TrialLog in
Avatar of mbresit
mbresitFlag for United States of America

asked on

Windows XP script to Windows 7

can someone assist with converting the following syntax from a windows XP script to where Windows 7 can run it

Set ObjFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHNetwork = CreateObject("WScript.Network")
Set objWMI = GetObject("WinMGMTS:root\cimv2")

strWQL = "SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'"

Set colIPResults = objWMI.ExecQuery(strWQL)

For Each objNIC In colIPResults
For Each strIPAddress in objNIC.IPAddress
            If Left(strIPAddress, 2) = 10 Then
                  strAddresses = strIPAddress
            End If
Next
Next

Set objDomain = GetObject("LDAP://rootDSE")
strDC = objDomain.Get("dnsHostName")

For Each objOS in GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
strOSName = objOS.Caption
strServicePack = objOS.ServicePackMajorVersion  
Next

Dim objNet
Dim strInfo

Set objNet = CreateObject("WScript.NetWork")

strInfo = "User Name = "                   & objNet.UserName & vbCRLF & vbCRLF & _
          "Computer Name = "                   & objNet.ComputerName & vbCRLF & vbCRLF & _
          "IP Address = "                   & strAddresses & vbCRLF & vbCRLF & _
        "Domain Controller = "             & strDC & vbCRLF & vbCRLF & _
        "Operating System = "                   & strOSName & vbCRLF & vbCRLF & _
        "Service Pack Version = "             & strServicePack
MsgBox strInfo
      
Set objNet = Nothing  
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial