PowerShell for Windows Admins:

WMI


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


May 13, 2012  10:34 AM

TCP/IP Alternative Configuration: pt I The configuration



Posted by: Richard Siddaway
Network, PowerShell, WMI

A question on the forum got me wondering about setting the Alternative Configuration on a TCP/IP properties of a network adapter. NICs are normally configured to either DHCP or a static address. If you use DHCP another tab “Alternative Configuration” appears on the IPv4 properties dialog....


May 6, 2012  8:00 AM

Scripting Games 2012 comments: #13 Default Printer



Posted by: Richard Siddaway
PowerShell, WMI

In one of the events you had to find the default printer. This can be done using WMI.

The full list of printers can seen using:

Get-WmiObject -Class Win32_Printer

 

If you want to examine the printer objecy – to determine what information is available -...


May 5, 2012  12:50 PM

Scripting Games 2012 comments: #12 date conversions



Posted by: Richard Siddaway
PowerShell, WMI

 

A few times in the games you were asked for date time based information. Now WMI has a lot of classes that return WMI information. It is in an awkward format though

PS> Get-WmiObject -Class Win32_OperatingSystem | fl *time*


CurrentTimeZone : 60


April 15, 2012  10:17 AM

PowerShell and WMI



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

My latest book – PowerShell and WMI – has gone to the printers. Expect it soon at a book shop near you.

www.manning.com/powershellandwmi

for more details


April 2, 2012  12:33 PM

Finding the primary name of a DNS alias record



Posted by: Richard Siddaway
DNS, PowerShell, WMI

A forum question asked how to find the primary name from an alias or CNAME record.

Get-WmiObject -Namespace 'root\MicrosoftDNS' -Class 			


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: