import-module bitstransfer
$Job = Start-BitsTransfer -Source c:\largefile.bak `
-Destination Z:\ -Asynchronous
while (($Job.JobState -eq "Transferring") -or ($Job.JobState -eq "Connecting")) `
{ sleep 5;} # Poll for status, sleep for 5 seconds, or perform an action.
Switch($Job.JobState)
{
"Transferred" {Complete-BitsTransfer -BitsJob $Job}
"Error" {$Job | Format-List } # List the errors.
default {"Other action"} # Perform corrective action.
}
Thursday, June 27, 2013
Powershell to export all farm solutions
Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction
SilentlyContinue
## setup our output directory
$dirName = "d:\Exported Solutions"
Write-Host Exporting solutions to $dirName
foreach ($solution in Get-SPSolution)
{
$id = $Solution.SolutionID
$title = $Solution.Name
$filename =
$Solution.SolutionFile.Name
Write-Host "Exporting ‘$title’ to
…\$filename" -nonewline
try {
$solution.SolutionFile.SaveAs("$dirName\$filename")
Write-Host
" – done" -foreground green
}
catch
{
Write-Host
" – error : $_" -foreground red
}
}
Subscribe to:
Posts (Atom)