Category Archives: PowerShell and CIM

Change 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 Description Description ———– PS> Get-CimInstance -ClassName Win32_OperatingSystem | Set-CimInstance -Property @{Description = ‘Richards Laptop’} PS> Get-CimInstance -ClassName … Continue reading

Posted in PowerShell and CIM | Leave a comment

More 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 Windows 8. Underneath the covers it … Continue reading

Posted in PowerShell and CIM, Storage | Leave a comment

Linking 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 Windows machines physical drives are divided into 1 or … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI, Storage | Leave a comment

Finding 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> Get-WmiObject -Class Win32_Process -Namespace … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

Find 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 {         $lguser = Invoke-CimMethod -InputObject $psitem -MethodName GetOwner         $Properties = … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

Are your domain controllers real?

A question on the forum asked about discovering if domain controllers are physical or virtual machines. This will do the job foreach ($domain in (Get-ADForest).domains) {   Get-ADDomainController -filter * -server $domain |   sort hostname  |   foreach { … Continue reading

Posted in PowerShell and Active Directory, PowerShell and CIM | Leave a comment

DiskPart and PowerShell–part 1

An attendee at the Summit made the statement that the DiskPart utility didn’t have any equivalent in PowerShell. That’s not strictly true as the storage module provides a lot of functionality that maps to diskpart functionality. The module contents include: … Continue reading

Posted in CDXML, Powershell, PowerShell and CIM | Leave a comment