Saturday, June 19, 2010

Some good links to Powershell

Good reading
http://www.techotopia.com/index.php/Using_COM_with_Windows_PowerShell

http://www.youdidwhatwithtsql.com/automating-internet-explorer-with-powershell/467
http://www.pvle.be/2009/06/web-ui-automationtest-using-powershell/
http://powershell.com/Mastering-PowerShell.pdf

Active Directory
http://blogs.technet.com/b/benp/archive/2007/04/10/creating-an-ad-shell.aspx
http://blogs.technet.com/b/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx

http://blogs.technet.com/b/benp/archive/2007/03/05/benp-s-basic-guide-to-managing-active-directory-objects-with-powershell.aspx

Good book to download
http://blogs.technet.com/b/chitpro-de/archive/2008/02/28/free-windows-powershell-workbook-server-administration.aspx

RAM Count : Poweshell

RAM in MB
$mem = Get-WmiObject -Class Win32_ComputerSystem
# Display memory
"This system has {0} MB Free Memory" -f $($mem.TotalPhysicalMemory/1mb)
Processor cOUNT
$system = Get-WmiObject -Class Win32_ComputerSystem

Non Working devices
Get-WmiObject Win32_PNPEntity | where {$_.ConfigManagerErrorcode -ne 0}

Friday, June 18, 2010

Determine whether a computer is a tower, a mini-tower, a laptop, and so on: Powershell

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objChassis in colChassis
For Each objItem in objChassis.ChassisTypes
Wscript.Echo "Chassis Type: " & objItem
Next
Next