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}
Advertisements

NetApp snapmirror lagtime check cdot with PowerShell

# Snapmirror cleanup – update all snapmirrors with lagtime over one week and idle

$mirrors = @()

Get-NcSnapmirror | %{
$sm = “” | Select “Source”,”Destination”,”Status”,”State”,”LagTime”

$sm.Source = $_.SourceLocation
$sm.Destination = $_.DestinationLocation
$sm.Status = $_.Status
$sm.State = $_.MirrorState
$sm.LagTime = $_.LagTime

$mirrors += $sm

}

$mirrors

write-output $mirrors | export-csv snap.csv

# write-output $mirrors | Format-table -AutoSize

# write-Output $mirrors | where- {$sm.LagTime -gt 604800 -and $sm.Status -eq “idle”} | Format-Table -AutoSize