Differences
This shows you the differences between the selected revisions of the page.
| 2014-11-25 | 2014-12-03 | ||
| moving misplaced section (martin) | parameterised powershell script (martin) | ||
| Line 58: | Line 58: | ||
| <code powershell> | <code powershell> | ||
| + | param ( | ||
| + | $localPath = "c:\downloaded\" | ||
| + | $remotePath = "/home/user/" | ||
| + | $fileName = "download.txt" | ||
| + | ) | ||
| + | |||
| try | try | ||
| { | { | ||
| Line 78: | Line 84: | ||
| $session.Open($sessionOptions) | $session.Open($sessionOptions) | ||
| - | $localPath = "c:\downloaded\" | ||
| - | $remotePath = "/home/user/" | ||
| - | $file = "download.txt" | ||
| - | |||
| # Format timestamp | # Format timestamp | ||
| $stamp = $(Get-Date -f "yyyyMMddHHmmss") | $stamp = $(Get-Date -f "yyyyMMddHHmmss") | ||
| Line 87: | Line 89: | ||
| # Download the file and throw on any error | # Download the file and throw on any error | ||
| $session.GetFiles( | $session.GetFiles( | ||
| - | ($remotePath + $file), | + | ($remotePath + $fileName), |
| - | ($localPath + $file + "." + $stamp)).Check() | + | ($localPath + $fileName + "." + $stamp)).Check() |
| } | } | ||
| finally | finally | ||