PowerShell for Windows Admins:

PowerShell v2


June 6, 2011  1:57 PM

Get-WmiObject property parameter



Posted by: Richard Siddaway
PowerShell v2

This is a fairly obvious piece of PowerShell

Get-WmiObject Win32_Volume

We would probably restrict the properties we displayed like this

Get-WmiObject Win32_Volume | select DriveLetter, DriveType, Freespace

or possibly

Get-WmiObject Win32_Volume |

June 3, 2011  12:54 PM

Invoke-WmiMethod parameters



Posted by: Richard Siddaway
PowerShell v2, WMI

The Invoke-WmiMethod cmdlet was new with PowerShell 2. 

In PowerShell v1 we would do something like this

(gwmi win32_Process -Filter "Name='Notepad.exe'").Terminate()

With the cmdlet we can do this

gwmi win32_Process -Filter...


June 3, 2011  5:13 AM

Powers



Posted by: Richard Siddaway
PowerShell v2, PSAM

Many numbers in computing are based on powers of 2. I need to calculate some powers of 2 and realised that PowerShell doesn’t have  an operator for raising  a number  to a power.  In many languages ** or ^ supply this functionality.

In PowerShell we drop back to...


May 29, 2011  2:57 AM

Manning Deal of the Day–29 May



Posted by: Richard Siddaway
Books, PowerShell v2, WMI

Today, for one day only, get 50% off PowerShell and WMI MEAP or MEAP+ebook.

 

The code is dotd0529cc when you order from www.manning.com

 

The same code can be used for PowerShell in Action – second edition and...


May 26, 2011  12:50 PM

root\wmi – speeding the testing



Posted by: Richard Siddaway
PowerShell v2, Windows 2008 R2, Windows 7, WMI

Testing the individual classes in root\wmi is a pain – so its time for some brute force.  I’ll select a group of classes and test the selection

gwmi -Namespace root\wmi -List system* | fw

 

I can then iterate through them calling get-wmiobject.

This...


May 26, 2011  12:42 PM

root\wmi – MS_SystemInformation



Posted by: Richard Siddaway
Hardware, PowerShell v2, Windows 2008 R2, Windows 7, WMI

Continuing our exploration of the murky jungle that is the root\wmi namespace we find a number of classes related to system configuration

gwmi -Namespace root\wmi -List *system* | fw

 

Of theses the only one I could get a respnse from on Windows 7 or Windows 2008 R2...


May 22, 2011  4:35 AM

New PAM version



Posted by: Richard Siddaway
PowerShell v2, PSAM

I’ve added the 0.6 release of the PowerShell Admin Modules to codeplex - http://psam.codeplex.com/

This release adds two modules

PAMADSNAPSHOT – functions for work with AD snapshots in Windows 2008...


May 19, 2011  1:22 PM

PowerShell in Action



Posted by: Richard Siddaway
Books, PowerShell v2

The second edition of Bruce Payette’s PowerShell in Action is available. It  can be ordered from http://www.manning.com/payette2/.  The electronic version includes a free electronic version of the...


May 19, 2011  12:31 PM

Method definitions



Posted by: Richard Siddaway
PowerShell v2

When we are dealing with .NET objects we have methods and properties to deal with. Properties are easy.

lets create a simple object

$str = "QWERTYUIOP"

 

put our string object into get-member to see the properties

$str | Get-Member...


May 17, 2011  11:34 AM

Updated PowerShell help



Posted by: Richard Siddaway
PowerShell v2

The PowerShell team have been updating the online help files since PowerShell v2 was released. Unfortunately your local help files haven’t been updated. This now changes with the release of a CHM file containing the updated help  files -


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: