PowerShell for Windows Admins:

WMI


June 8, 2012  12:22 PM

Working with profiles: 2 deleting profiles



Posted by: Richard Siddaway
PowerShell 3, PowerShell v2, Users, WMI

I recently (1 June) showed how to discover the user profiles on your system. Now its time to delete them.

function remove-profile {            
 
				
				
  Bookmark and Share     0 Comments     RSS Feed     Email a friend

June 2, 2012  8:19 AM

Toggling between LAN and Wireless



Posted by: Richard Siddaway
Network, PowerShell 3, Windows 8, Windows Server 8, WMI

One of the questions in the recent Scripting Games involved toggling between a wireless and LAN connection. Only one was to be up at any one time.

This can be solved using WMI but becomes hugely simpler in Windows 8/2012 as we get a bunch of cmdlets for working with network adapters.

...


June 1, 2012  1:07 PM

Working with profiles: part 1



Posted by: Richard Siddaway
PowerShell 3, PowerShell v2, WMI

A question came up on the forum for PowerShell and WMI – how do I delete profiles. I’m going to work up to answering that by looking at using WMI to work with profiles.

So to start how can we find the...


May 25, 2012  11:58 AM

Working with WMI methods



Posted by: Richard Siddaway
PowerShell 3, PowerShell v2, WMI

Many WMI classes have methods. Methods allow us to perform some action on the object. A recent question on the forum about using methods made me realise that there are still a lot of people following the old VBScript way of doing things.

We will experiment with the BITS service as it is...


May 23, 2012  12:46 PM

WMI providers



Posted by: Richard Siddaway
PowerShell 3, WMI

I found a class new to me - Msft_Providers and this got me interested in WMI providers.

PS> Get-CimInstance -Class Msft_Providers | select -ExpandProperty provider
Msft_ProviderSubSystem
SCM Event Provider
WmiPerfClass

 

That seems a...


May 20, 2012  12:40 PM

Using Invoke-WmiMethod to set the DNS servers



Posted by: Richard Siddaway
Network, PowerShell 3, PowerShell v2, WMI

In the last post I showed that there was an issue with the way the SetDNSServerSearchOrder of the Win32_NetworkAdapterConfiguration class worked

This would work

$nic = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index=7"


May 20, 2012  4:34 AM

TCP/IP Alternative Configurations: pt IV reset to static address



Posted by: Richard Siddaway
Network, PowerShell, WMI

At some stage we may need to reset our NIC back to having a static address

$index = 7            
            
$nic 
				
				
  Bookmark and Share     0 Comments     RSS Feed     Email a friend


May 16, 2012  3:12 PM

TCP/IP Alternative Configuration: pt II Set DHCP



Posted by: Richard Siddaway
Network, PowerShell, WMI

The next step on our journey to an alternative configuration is setting the NIC to use DHCP

I will keep cheating for now and specify the NIC – on my machine I now it is the NIC whose Win32_NetworkAdapterConfiguration has an Index of 7


				
				
  Bookmark and Share     0 Comments     RSS Feed     Email a friend


May 15, 2012  11:37 AM

Test-Connection on PowerShell v3



Posted by: Richard Siddaway
PowerShell 3, WMI

Following on from the previous post I performed the same tests on PowerShell v3

The behaviour is the same except that

Test-Connection -ComputerName . -Count 4 –AsJob

now give the 4 pings when you receive the job information


May 14, 2012  3:23 PM

Test-Connection oddities



Posted by: Richard Siddaway
PowerShell, WMI

I’ve playing around with Test-Connection because I wanted to set up a long running WMI based job and I thought that pinging a machine lots of times would be a good way to do it. Test-Connection uses the Win32-PingStatus class.

I started with this

  Bookmark and Share     0 Comments     RSS Feed     Email a friend