This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static void SimpleMethod() | |
{ | |
Console.WriteLine("Hello Method World!"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SimpleFunction | |
{ | |
Out-Host "Hello method host" | |
} | |
SimpleFunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static int Increment(int number) | |
{ | |
return ++number; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Increment | |
{ | |
Param([int] $number) | |
$result = $number+1 | |
$result | |
} | |
Write-Host "And the answer is" (Increment 41) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MultipleParameters | |
{ | |
Param( | |
[Parameter(Position = 0)][string]$Message, | |
[Parameter(Position = 1)][string]$SecondMessage, | |
[Parameter(Position = 2)][bool]$PrintItYellow | |
) | |
if($PrintItYellow) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[string]$Message, | |
[string]$SecondMessage, | |
[bool]$PrintItYellow | |
) | |
if($PrintItYellow) | |
{ | |
Write-Host "$Message $SecondMessage" -ForegroundColor "Yellow" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.\MultipleParameter.ps1 -Message "Hello" -SecondMessage "Dear Reader" -PrintItYellow $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DefaultValues | |
{ | |
Param( | |
[Parameter(Position = 0)][string]$Message = "Hello from the standard parameters", | |
[Parameter(Position = 1)][string]$SecondMessage = "", | |
[Parameter(Position = 2)][bool]$PrintItYellow = $false | |
) | |
if($PrintItYellow) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Looks like I'll be the string ending up in a file..." >> "SomeFile.txt" | |
"What are you complaining about I'll be remembered as the second line..." >> "SomeFile.txt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$powerShellObject = Invoke-WebRequest "https://mallibone.com" | |
$Filename = ((Get-Date -format "yyyyMMMdd_HHmm") + "_mallibone_dump.xml") | |
$powerShellObject.Links | Export-Clixml $Filename |