Script para Buscar Equipos y entradas en el registro

'**********************************************************************************************************************************
'**********************************************************************************************************************************

Set WSHShell = WScript.CreateObject("WScript.Shell")

'**********************************************************************************************************************************
'Declaracion de variable SO para comparar Sistema Operativo de la máquina

SO = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProductName")
SOVer = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CSDVersion")
'**********************************************************************************************************************************
'Verificación tipo de equipo

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colChassis = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure")
For Each objChassis in colChassis
   For  Each strChassisType in objChassis.ChassisTypes
       Select Case strChassisType
           Case 1
            PCTYPE = "Other"
            Exit For          
           Case 2
            PCTYPE = "Unknown"
            Exit For       
           Case 3
            PCTYPE = "Desktop"
            Exit For       
           Case 4
            PCTYPE = "Low Profile Desktop"
            Exit For       
           Case 5
            PCTYPE = "Pizza Box"
            Exit For       
           Case 6
            PCTYPE = "Mini Tower"
            Exit For       
           Case 7
            PCTYPE = "Tower"
            Exit For       
           Case 8
            PCTYPE = "Portable"
            Exit For       
           Case 9
            PCTYPE = "Laptop"
            Exit For       
           Case 10
            PCTYPE = "Notebook"
            Exit For       
           Case 11
            PCTYPE = "Handheld"
            Exit For       
           Case 12
            PCTYPE = "Docking Station"       
            Exit For           
           Case 13
            PCTYPE = "All in one"
            Exit For
           Case 14
            PCTYPE = "Sub-Notebook"
            Exit For       
           Case 15
            PCTYPE = "Space Saving"
            Exit For
           Case 16
            PCTYPE = "Lunch Box"
            Exit For
           Case 17
            PCTYPE = "Main System Chassis"
            Exit For
           Case 18
            PCTYPE = "Expansion Chassis"
            Exit For
           Case 19
            PCTYPE = "Sub-Chassis"
            Exit For
           Case 20
            PCTYPE = "Bus Expansion Chassis"
            Exit For
           Case 21
            PCTYPE = "Peripheral Chassis"
            Exit For
           Case 22
            PCTYPE = "Storage Chassis"
            Exit For
           Case 23
            PCTYPE = "Rack Mount Chassis"
            Exit For
           Case 24
            PCTYPE = "Sealed-Case PC"
            Exit For
           Case Else
            PCTYPE = "Unknown"
            Exit For
           End Select
   Next
Next

If SO = "Microsoft Windows XP" Then

    If PCTYPE = "Desktop" or PCTYPE = "Notebook" or PCTYPE = "Laptop" Then

        MsgBox "Windows version: " + SO

        MsgBox "Tipo de equipo: " + PCTYPE
    End If

End If

Published 19/5/2009 16:22 por M@rTIn's
Comparte este post:
http://geeks.ms/blogs/mojeda/archive/2009/05/19/script-para-buscar-equipos-y-entradas-en-el-registro.aspx

Comentarios

# re: Script para Buscar Equipos y entradas en el registro

Viendo tus ejemplos me imagino que participaras en los Scripting Games de este año verdad?

www.microsoft.com/.../announcement.mspx

Tuesday, May 19, 2009 11:26 PM por Richard