Skip to content

Instantly share code, notes, and snippets.

View alexandair's full-sized avatar

Aleksandar Nikolić alexandair

  • Novi Sad, Serbia
View GitHub Profile
$options = @{
AddToHistoryHandler = {
param( [string]$line)
return $line.Length -gt 3 -and $line[0] -ne ' ' -and $line[0] -ne ';'
}
}
Set-PSReadLineOption @options
{
"title": "Test tour",
"steps": [
{
"file": "Test-CodeTour.ps1",
"line": 4,
"description": "### Step 1\r\n\r\nThis is the first command in the script.\r\nIt will show you today's date. Simple as that.",
"contents": "\r\n# a script to test the CodeTour extension\r\n\r\nGet-Date\r\n\r\nfunction foo {\r\n Write-Output \"foo\"\r\n}\r\n\r\n# Call a function\r\nfoo\r\n\r\n"
},
{
$sourceuri = "ftp://ftp.example.com/myfolder/myfile.xml"
$filePath = "C:\temp\myfile.xml"
$username = "user"
$password = "password"
# Create a FTPWebRequest object to handle the connection to the ftp server
$ftprequest = [System.Net.FtpWebRequest]::create($sourceuri)
$credentials = New-Object System.Net.NetworkCredential($username,$password)
# set the request's network credentials for an authenticated connection
$sourceuri = "ftp://speedtest.tele2.net/1MB.zip"
$targetpath = "C:\temp\1mb.zip"
$username = "anonymous"
$password = "anonymous"
# Create a FTPWebRequest object to handle the connection to the ftp server
$ftprequest = [System.Net.FtpWebRequest]::create($sourceuri)
# set the request's network credentials for an authenticated connection