Win32_Process examples–set priority
Changing the priority of a process can give a processing boost to an application – but its not always a safe option. You can modify the process like this: function set-procpriority { [CmdletBinding()]...
View ArticleWin32_Process examples–terminate process
Terminating a running process is simply a case of calling the Terminate method: function remove-proc{ [CmdletBinding()] param ( [string]$computername = $env:COMPUTERNAME, [string]$processname )...
View ArticleWin32_Process examples
In case you were wondering where the examples came that inspired the code in this series from its here – http://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx I’m providing PowerShell examples...
View ArticleWin32_Process examples–running scripts
Back in the day when all we had was VBScript you could run scripts through the command line (cscript) or you would get a more graphical interface (wscript). One of the examples at...
View ArticleDSC and WMI
Like all well behaved technology Desired State Configuration (DSC) requires access to WMI. Specifically it needs root/Microsoft/Windows/DesiredStateConfiguration This is available on the Windows 2012...
View ArticleI’m afraid you can’t do that anymore
In PowerShell 1.0 you could do this: notepad $proc = Get-WmiObject -Class Win32_Process -Filter “Name=’notepad.exe’” $proc.Terminate() To access the methods of the WMI class you had to get a variable...
View ArticleWMI type accelerators
Something you don’t see used very often but that you need to be aware of are the WMI type accelerators. These were introduced as part of PowerShell 1.0 and have continued to be available in later...
View ArticleDiscovering CIM/WMI methods and parameters
As you’ve probably gathered I spend a lot of time working with, and investigating, CIM (WMI) classes. CIM and WMI will be treated as synonymous for these articles. If you want to discover the methods...
View ArticleImproving CIM/WMI method discovery
I recently showed how to create a function that could be used to simplify the use of Get-CimClass. In this version I’ve added some features: - parameter validation - namespace - try-catch round getting...
View ArticleDiscovering namespaces
Next point on the journey of discovery through CIM is finding the namespaces installed on a machine. I showed how to do this using Get-WmiObject in PowerShell and WMI but this time round decided to...
View ArticleCIM snippets–working with file system
The latest instalment from the WMI team on using PowerShell and the CIM cmdlets is available –...
View ArticleDiscovering namespaces part 2
I recently showed how to use Get-CimInstance to discover the namespaces present in a particular CIM namespace. I’m going to try to use CIM instaed of WMI but expect the old terminology to creep in...
View ArticleFinding the class key
Time to extend our module for investigating CIM. This time I want to show you how to find the key to the class. You need to know the key property of a CIM class when you perform a number of actions –...
View ArticleChecking license activation
I’m building some virtual machines for my demo’s at the upcoming PowerShell summit. To make the demo’s, and setup, more interesting(?) I decided to use some Server Core instances. The usual setup...
View ArticleStatus of Office software
You can also use the SoftwareLicensingProduct CIM class to test the status of your Office products. Get-CimInstance -ClassName SoftwareLicensingProduct -Filter “Name LIKE ‘Office%’” | where...
View ArticleWMI against remote machines
WMI is a great tool for managing your Windows machines – I’d argue that PowerShell wouldn’t be as powerful as it is without WMI. If you question that remember that 60% of the additional cmdlets in...
View ArticleShare Permissions – adding
Having seen how to read the permissions on a share its time to turn to one of the other common tasks associated with shares – adding permissions. This is usually done when the share is created but...
View ArticleShare Permissions – Removing
You’ve seen how to read share permissions and how to add share permissions – now its time to remove share permissions. Most of the code we need is in the Add-Sharepermission function – it just needs a...
View ArticleShare Permissions – changing
So far you’ve seen how to read, remove and add permissions to a share. The final scenario to be covered is modifying a permission. The functions I’ve presented to date only enable you to set Allow...
View ArticleShare Permissions – working with Deny
Permissions can be set to either allow access ot to deny access. The functions I’ve presented so far only work with Allow permissions. Using Deny permissions should be avoided if at all possible but...
View Article