Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Tuesday, July 27, 2010

How to install the VESI

Please read the following post The VESI – Getting it up and running from Arnim van Lieshout

Wednesday, July 7, 2010

How to install and use PowerShell Management library for Hyper-V R2

Read the following posts:
http://trycatch.be/blogs/roggenk/archive/2010/02/08/powershell-management-library-for-hyper-v-r2.aspx
http://trycatch.be/blogs/roggenk/archive/2010/05/26/managing-windows-server-2008-r2-using-powershell.aspx
Examples:
# get default VHD path for server ariadne
Get-VHDDefaultPath -server ariadne
# get VM state for all VMs in server ariadne with a formated output
get-VMState -server ariadne | ft -property VMElementName,GuestOS,EnabledState,Name -auto
# Start a VM Session
New-VMConnectSession -vm strgsrv -server ariadne
# Start a VM
Start-VM -vm strgsrv -server ariadne
# Shutdown a VM
Invoke-VMShutdown -vm strgsrv -server ariadne -Force
# Shutdown all VMs in server ariadne
Invoke-VMShutdown (Select-VM -Server ariadne -Multiple) -Force
# Shutdown all VMs in server ariadne
Get-VM -Server ariadne -Running | Invoke-VMShutdown -Force
# List all stopped VMs in server ariadne
get-VM -Server ariadne -Stopped
# Start all VMs in server ariadne
get-VM -Server ariadne -Stopped | Start-VM
# Get a build script for VM strgsrv of server ariadne
Get-VMBuildScript -vm strgsrv -server ariadne

Sunday, November 15, 2009

Script to list installed software on local computer

from http://myitforum.com/cs2/blogs/yli628/archive/2008/01/16/powershell-script-to-list-installed-software-on-local-computer.aspx

$a = New-Object -comobject Excel.Application
$a.visible = $True

$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)

$c.Cells.Item(1,1) = "Name"
$c.Cells.Item(1,2) = "Version"
$c.Cells.Item(1,3) = "Publisher"
$c.Cells.Item(1,4) = "InstalledOn"
$c.Cells.Item(1,5) = "HelpLink"
$c.Cells.Item(1,6) = "UninstallString"

$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True

$intRow = 2

$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall

$Items = $keys |foreach-object {Get-ItemProperty $_.PsPath}

foreach ($item in $items)
{
$c.Cells.Item($intRow,1) = $item.Displayname
$c.Cells.Item($intRow,2) = $item.DisplayVersion
$c.Cells.Item($intRow,3) = $item.Publisher
$c.Cells.Item($intRow,4) = $item.InstallDate
$c.Cells.Item($intRow,5) = $item.HelpLink
$c.Cells.Item($intRow,6) = $item.UninstallString

$intRow = $intRow + 1
}

$d.EntireColumn.AutoFit()

or you can try this in one line script

gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |Select DisplayName, DisplayVersion, Publisher, InstallDate, HelpLink, UninstallString |ogv