Solved

wmi script

Posted on 2007-12-05
4
533 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

914 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

17 Experts available now in Live!

Get 1:1 Help Now