Solved

wmi script

Posted on 2007-12-05
4
531 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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show, step by step, how to integrate R code into a R Sweave document
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…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…

758 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now