Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

wmi script

Posted on 2007-12-05
4
538 Views
Last Modified: 2010-08-05
i need a wmi script to use in group policy.  i need it to filter laptops from the policy so it only applies to workstation desktops.  what our goal is to filter .mp3, .wavs and laptops from this policy for folder redirection of the users my documents folder to a server for backup.  I am not a script guy so i need some help with this. thanks in advance
0
Comment
Question by:scripttron75
  • 2
4 Comments
 

Author Comment

by:scripttron75
ID: 20416667
cant anyone help on this??
0
 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20417192
Try this....


regards
Chandru
Option Explicit
Dim strComputer, strChassis
Dim objWMIService, objChassis, colChassis, objItem
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure",,16)
For Each objChassis in colChassis
  For Each objItem in objChassis.ChassisTypes
    Select Case objItem
    Case 1 strChassis = "Maybe Virtual Machine"
    Case 2 strChassis = "??"
    Case 3 strChassis = "Desktop"
    Case 4 strChassis = "Thin Desktop"
    Case 5 strChassis = "Pizza Box"
    Case 6 strChassis = "Mini Tower"
    Case 7 strChassis = "Full Tower"
    Case 8 strChassis = "Portable"
    Case 9 strChassis = "Laptop"
    Case 10 strChassis = "Notebook"
    Case 11 strChassis = "Hand Held"
    Case 12 strChassis = "Docking Station"
    Case 13 strChassis = "All in One"
    Case 14 strChassis = "Sub Notebook"
    Case 15 strChassis = "Space-Saving"
    Case 16 strChassis = "Lunch Box"
    Case 17 strChassis = "Main System Chassis"
    Case 18 strChassis = "Lunch Box"
    Case 19 strChassis = "SubChassis"
    Case 20 strChassis = "Bus Expansion Chassis"
    Case 21 strChassis = "Peripheral Chassis"
    Case 22 strChassis = "Storage Chassis" 
    Case 23 strChassis = "Rack Mount Unit"
    Case 24 strChassis = "Sealed-Case PC" 
 
    End Select
  Next
Next
WScript.Echo "Computer chassis type: " & strChassis
'WScript.Echo strComputer & "'s chassis type: " & strChassis 
 
WScript.Quit 
 
' End of WMI VBScript - Chassis type

Open in new window

0
 
LVL 3

Expert Comment

by:top_gizmo
ID: 20417322
If your desktops and laptops have a different naming convention you can create a wmi filter to filter them out (that is how I do it)

It is much simpler than using the above script by Chandru.  Although it is an awesome script.  I used it for other functions also, BUT be advised a laptop in a docking station sometimes will report it chassis type as a docking station, so that is another variable to have to work into your filter.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20421498
thanks scripttron75 for the Grade
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question