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

Working with profiles: 2 deleting profiles

I recently (1 June) showed how to discover the user profiles on your system. Now its time to delete them. function remove-profile { param ( [parameter(Mandatory=$true)] [string]$username ) $user =...

View Article


WMI property names

A question brought it home to me that WMI property names don’t always mean what you might think they mean – this is also true of other objects but I tripped over this one with WMI so we’ll stick with...

View Article


Windows 8 Networking cmdlets

Windows 8 brings PowerShell v3 and a whole bunch of PowerShell modules.  One such module is NETTCPIP and as the name suggests is about networking. PowerShell v3 automatically loads modules for you so...

View Article

Windows 8 RTM startup

I was looking at Win32_OperatingSystem today and noticed that the last boot up time wasn’t right PS> Get-CimInstance -ClassName Win32_OperatingSystem | select LastBootUpTime LastBootUpTime ————–...

View Article

Finding if the user associated with a profile is logged on

A forum question asked how to find if the user to whom a profile belonged was logged on. There isn’t an easy way as there isn’t an association between the profile and the log on session. There is a...

View Article


Finding the drive letter of a mounted VHD

In Windows 8/2012 you can mount a VHD into the file system. Is there a way to discover the drive letter of the mounted VHD function get-mountedvhdDrive { $disks = Get-CimInstance -ClassName...

View Article

WMI over WSMAN

Every time I look at PowerShell v3 I seem to find a new way to access WMI! I’ve covered the –ComputerName and –CimSession parameters before but to recap We duplicate the way Get-WmiObject works:...

View Article

Image may be NSFW.
Clik here to view.

Jobs, WMI, CIM and more jobs

Background jobs were one of the most undervalued aspects of PowerShell v2. With the introduction of PowerShell v3 we get ways to schedule those jobs. In this post though I want to look at the new CIM...

View Article


WMI –property parameter

One parameter that seems to get overlooked on Get-WmiObject is the –Property parameter. It is used to specify the properties you want returned. This is what you would normally get by default: PS>...

View Article


New about files

PowerShell v3 features updateable help.  The help files are not quite complete at the moment but a recent update to the help that is available brought a couple of very useful files: about_WMI about_WQL...

View Article

Get-CimClass changes

One thing that I don’t think I’ve mentioned is that the Get-CimClass output changed during the development process. In PowerShell v3 RTM you can dig into a WMI class like this Get-CimClass -ClassName...

View Article

Displaying data from multiple servers as HTML

A forum question regarding retrieving WMI based data from multiple servers and displaying it as HTML was interesting.  I would approach it like this $servers = Get-Content -Path C:\scripts\servers.txt...

View Article

Number of processors in a box

WMI enables you find the number of processors in your system: PS> Get-WmiObject -Class Win32_ComputerSystem | fl Number* NumberOfLogicalProcessors : 2 NumberOfProcessors        : 1 This works fine...

View Article


Account SIDs

A question on the forum asked about finding the accounts and SIDs on the local machine. function get-SID { param ( [string]$computername = $env:COMPUTERNAME ) Get-WmiObject -Class Win32_AccountSID...

View Article

Account SIDs revisited

I realised there is an easier way to get the data function get-SID { param ( [string]$computername = $env:COMPUTERNAME ) Get-WmiObject -Class Win32_AccountSID -ComputerName $computername | foreach {...

View Article


Account SIDs–hopefully my last word

Ok the embarrassing moral of this story is that you shouldn’t answer questions in a hurry at the end of the evening. 5 minutes after shutting down I realised that there is a far, far simpler way to get...

View Article

Filtering

I’ve been grading the scripts in the warm up events for the Scripting Games and noticed a lot of people doing this: Get-WmiObject -Class Win32_LogicalDisk | where {$_.DriveType -eq 3} Ok now it works...

View Article


CIM cmdlets and remote access

When you used the WMI cmdlets Get-WmiObject -Class Win32_logicalDisk -ComputerName RSLAPTOP01 You were using DCOM to access the remote machine. Even if you accessed the local machine you were using...

View Article

Network adapters

The WMI classes Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration have seen a lot of use over the years. They can be a bit fiddly to use which is why the NetAdapter module in Windows 8/2012 is...

View Article

Network Adapters–Disable/Enable

Last time we saw the Get-NetAdapter cmdlet from the NetAdapter module PS> Get-NetAdapter | ft Name, InterfaceDescription, Status -a Name     InterfaceDescription                           Status —-...

View Article
Browsing all 140 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>