PowerShell for Windows Admins:

CIM


January 29, 2017  9:50 AM

Finding DNS static records

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, DNS, Powershell

An interesting question from the forums about finding DNS static records You can view the records in a DNS zone Get-CimInstance -Namespace root\MicrosoftDNS -ClassName MicrosoftDNs_Atype -ComputerName W16DC01  -Filter "DomainName = 'manticore.org'" | select OwnerName, Timestamp,...

January 27, 2017  4:48 AM

wmic deprecated

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

I saw a forum post today where the question involved the use of the wmi command line tool wmic. Wmic was deprecated in Windows Server 2012 - 0 Comments     RSS Feed     Email a friend


December 22, 2016  1:54 PM

Applying updates through WSUS

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, Windows Server 2016, WMI

I like to keep the virtual machines in my test lab up to date so have a WSUS server to download and manage updates. The difficulty is applying the updates. With Windows 2012 R2 I used a module that would contact the WSUS server and apply the updates – the was especially useful on server core...


November 4, 2016  10:51 AM

ComputerName parameters for CIM and WMI cmdlets

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Accessing a remote system and running Get-WmiObject -ClassName Win32_LogicalDisk -ComputerName $computer or Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName $computer is a standard approach. If you’re creating a function with that code in you may put the local machine as...


November 4, 2016  10:03 AM

Working with multiple CIM objects

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Many of the CIM objects we work with in our computers come in multiple instances – disks and network cards are a couple of examples. Many times when you see examples you’ll see something like this: $disks = Get-WmiObject -Class Win32_LogicalDisk foreach ($disk in $disks){ if ($disk.Size...


October 18, 2016  2:07 PM

Server Uptime

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Its easy to get the last boot time of a Windows machine but how do you get the uptime function Get-Uptime { [CmdletBinding()] param ( [string]$ComputerName = $env:COMPUTERNAME ) $os = Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName $uptime = (Get-Date) -...


October 4, 2016  12:50 PM

Filter early and WQL

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

What’s wrong with this: Get-CimInstance -ClassName Win32_Service | where {$_.State -eq 'Running' -and $_.StartName -notlike 'LocalSystem' -and $_.StartName -notlike 'NT Authority*'} | select PSComputerName, Name, DisplayName, State, StartName Nothing except that its inefficient. if you...


September 16, 2016  12:45 PM

Dealing with CIM properties that are integer arrays

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Saw a post about WmiMonitorID that intrigued me If you use the WmiMonitorID: PS> Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | select -f 1 Active                 : True InstanceName           :...


September 3, 2016  12:14 PM

Open source PowerShell and OMI

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Open source, Powershell

OMI – the Open Source CIM server is available on github https://github.com/Microsoft/omi This appears to be a later version than currently shown on the open group web site Combine this with open...


August 30, 2016  12:26 PM

Optimising WMI calls–part 3

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

The next change just uses 1 call to get the disk information instead of 2 Measure-Command -Expression { $srvs = 'W16TP5TGT01', 'W16TP5TGT02' for ($i=1; $i -le 150; $i++){ foreach ($srv in $srvs) { $cs = New-CimSession -ComputerName $srv $bootupMemory = Get-CimInstance -Query "SELECT *...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: