Find installed software with Powershell, function

$livecred = get-credential

function findsoftware {
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where {$_.Publisher -match 'NetApp, Inc.'}
}

invoke-command -computername server1, server2, server3 -credential $livecred -ScriptBlock ${function:findsoftware}
Advertisements

Back up file on remote server with PowerShell

function RemoteCopy {
	Set-Location "e:\somepath\somedir"
	copy-item somefile.properties "somefile.properties.$(get-date -f yyyyMMdd)" -Force
}

Invoke-Command -ComputerName someserver -ScriptBlock ${function:RemoteCopy}