Quantcast
Channel: WMI – PowerShell for Windows Admins
Browsing all 140 articles
Browse latest View live

WMI vs CIM

An email debate yesterday regarding the use of the CIM cmdlets (new in PowerShell 3) vs the WMI cmdlets made me realise that other people are probably wondering the same thing, The question is really...

View Article


CIM cmdlets

The CIM cmdlets are found in the CIMcmdlets module. Get-Command -Module CimCmdlets  produces this list of names.  I’ve added some information on the tasks they perform Get-CimAssociatedInstance  is for...

View Article


Shutting down a remote computer

PowerShell provides the Stop-Computer cmdlet for closing down a remote machine. I find this especially useful in my virtual test environment. I’ll have several machines running but won’t necessarily...

View Article

Manning Deal of the Day – April 6 2013

My PowerShell and WMI book will be Manning’s deal of the day for 6 April 2013.  The deal will go live at Midnight US ET and will stay active for about 48 hours. This is your chance to get the book with...

View Article

CIM cmdlets vs WMI cmdlets–speed of execution

One question that came up at the summit was the comparative speed of execution of the new CIM cmdlets vs the old WMI cmdlets.  No of us knew the answer because we’d never tried measuring the speed. I...

View Article


CIM vs WMI cmdlets-remote execution speed

Following on from my previous post we’ll look at how the two types of cmdlets compare for accessing remote machines. I used a similar format to the previous tests but was accessing a remote machine....

View Article

WMI vs CIM speed tests–the final round

As a final test I want to see what happened when I ran multiple commands against the remote machine. PS> 1..100 | foreach { Measure-Command -Expression{1..100 | foreach { Get-WmiObject -Class...

View Article

Scripting Games–how not to output data

I haven’t finished blogging about event 1 yet but this caught my eye. Things aren’t too bad until we hit the bunch of write-host calls $wrks = (Get-Content -path C:\IPList.txt) foreach ($wrk in $wrks)...

View Article


Scripting Games-don’t repeat the work

There are some good features to this script but what really hurts is the two trips to the server for the Win32_Computersystem class Foreach ($IP in (Get-Content “C:\IPList.txt”)) { $Name =...

View Article


Scripting Games–filtering on remote server

In event 3 you have to get information on hard disk capacity. I’ve only looked at the first couple of dozen scripts but seen this too many times Get-WmiObject -Class Win32_LogicalDisk | where DriveType...

View Article

Scripting Games – Win32_LogicalDisk or Win32_Volume

I have heard some discussions recently regarding whether Win32_LogicalDisk or Win32_Volume should be used in the answer to event 3 in the Scripting Games. The problem requires you pull the drive...

View Article

Creating DNS PTR records

When I was writing the DNS chapter of PowerShell in Practice I couldn’t get the CreateInstanceFromPropertyData method on the MicrosoftDNS_PTRType class to work. Revisiting DNS for AD management in a...

View Article

WMI association example

A question came up on the Powershell.org forum about finding the groups of which local accounts are members You can get account data using Win32_UserAccount Group information is held in Win32_Group....

View Article


The inverse association

In my last post I showed how to find the groups of which a local user is a member. A comment was left asking about the inverse relationship. In this case we can just turn the code round....

View Article

Writable properties for a WMI class

Do you know how to discover which properties on a WMI class, and therefore a WMI instance, can be modified? Get-CimClass from the PowerShell 3.0 CIM cmdlets is the answer: $class = Get-CimClass...

View Article


Refreshing values

The CIM cmdlets in PowerShell v3 enable you to refresh the data in the object. Try this: $p = Get-CimInstance -ClassName Win32_PerfFormattedData_PerfOS_Processor $p | Get-CimInstance | select...

View Article

Deleting Folders with WMI

I recently saw a question about deleting folders with WMI. Let’s create a file structure we’re happy to delete New-Item -Path c:\ -Name Expendable -ItemType Directory New-Item -Path c:\Expendable -Name...

View Article


Deleting a file with WMI

Following on from the last post this is how you can delete a file. Use the same file structure as previously This time you need to use the CIM_DataFile class. It’s one of the few classes I’ve found...

View Article

Image may be NSFW.
Clik here to view.

Time oddity

I was looking for a test of time synchronisation on domain controllers and knew that the .NET domain controller object held a system property. So, I cam up with this $dom =...

View Article

WMI and Trusts

When you install AD on a machine you get the MicrosoftActiveDirectory WMI namespace as well. This namespace was deprecated in Windows 2012 but while it is still available there are few useful things we...

View Article
Browsing all 140 articles
Browse latest View live