Testing Windows activation
Testing Windows activation from PowerShell involves a little dive into CIM (WMI). At its simplest a function like this function test-activation { $ta = Get-CimInstance -ClassName...
View ArticleVolume friendly name
When you use Get-Volume one of the properties displayed is the volume friendly name PS> Get-Volume -DriveLetter C DriveLetter FriendlyName FileSystemType ———– ———— ————– C...
View ArticleLogon sessions
Saw a question about logon sessions that had me looking at CIM class Win32_LogonSession. I really don’t like the example code they have – code shouldn’t posted that contains aliases especially the...
View ArticleWindows Server 2019 updates with CIM
Windows Server 2019 updates with CIM remain the same as all server versions post Windows Server 2016. This code will check for and install any updates. Micorosft Update or WSUS will be used depending...
View ArticleCIM_Component class
I saw a question about the CIM_Component class and wondered what it was. So I tried it PS> Get-CimInstance -Namespace root\CIMV2 -ClassName CIM_Component | select -f 1 | fl * GroupComponent :...
View ArticleFile searches with WMI
I saw a question about file searches with WMI. If you just know the file name it’s a very slow process. Painfully slow. If you have an idea about the folder its much quicker. function get-wmifile {...
View Articleuser logon time
Saw an interesting question about user logon time. How can you tell the logged on user and when they logged on $logon = Get-CimInstance -ClassName Win32_LogonSession | sort StartTime -Descending |...
View ArticleWMI and CIM accelerators
In PowerShell an accelerator is a shortcut to a .NET type. The WMI accelerators have been around since PowerShell v1. The WMI accelerators were heavily used in v1 fill some of the gaps in cmdlet...
View ArticleCIM references and associations
Way back in 2011, when I were just a young lad, I wrote about WMI or CIM references and associations – https://wordpress.com/read/blogs/16267735/posts/1673 ASSOCIATORS show the end point of the link...
View ArticleCIM_ or Win32_
If you dig into the classes available on a Windows machine you’ll see a mixture of prefixes – namely CIM_ and Win32_ used for the classes. So which should you use CIM_ or Win32_ Lets start by seeing...
View ArticleWindows Updates CIM classes
When Windows 10 and Server 2016 were released they contained a new CIM namespace – ROOT/Microsoft/Windows/WindowsUpdate This contained a CIM class MSFT_WUOperationsSession that had 2 very useful...
View ArticleArticle 0
A question on the forum about getting monitor resolution led to this code Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorId | foreach { $filter = ("InstanceName =...
View ArticleExamples of replacing WMI cmdlet with CIM cmdlet
Following my last post I was asked about these Examples of replacing WMI cmdlet with CIM cmdlet. Example 1 gwmi win32_operatingsystem -computername $Computer -credential $creds, $cs = New-CimSession...
View ArticleCIM not WMI
I still see a lot of people using the WMI cmdlets – Get-WmiObject etc. You really should be using CIM nit WMI. In other words use Get-CimInstance rather than get-WmiObject etc etc. Why do I say that?...
View ArticleChange a computer’s description
The Win32_OperatingSystem class exposes the machines Description. This is how you can easily change a computer’s description. PS> Get-CimInstance -ClassName Win32_OperatingSystem | select...
View ArticleMore diskinfo
Yesterday I showed how to get the disk, partition and logical disk information using CIM. Today I want to show more diskinfo techniques. This time we’ll use the Storage module which was introduced with...
View ArticleLinking disks, partitions and logical drives
A question of the forums was asking about discovering disk information. They were trying to pipe the output of Get-WmiObject into another Get-WmiObject. that won’t work. There is another way. On...
View ArticleFinding a CIM class
One of the problems you might find is finding a CIM class. You know its name but you don’t know which namespace its in. The old WMI cmdlets allow you to search the namespaces recursively PS>...
View ArticleFind the logged on user
One method of finding the logged on users is to use CIM $ComputerName = $env:COMPUTERNAME Get-CimInstance -ClassName Win32_Process -ComputerName $ComputerName -Filter "Name = 'explorer.exe'" | foreach...
View ArticleAre your domain controllers real?
A question on the forum asked about discovering if domain controllers are physical or virtual machines. In other words Are your domain controllers real? This will do the job: foreach ($domain in...
View Article