Solved

wmi script

Posted on 2007-12-05
4
547 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

696 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