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 Trace-Word | |
| { | |
| [Cmdletbinding()] | |
| [Alias("Highlight")] | |
| Param( | |
| [Parameter(ValueFromPipeline=$true, Position=0)] [string[]] $content, | |
| [Parameter(Position=1)] | |
| [ValidateNotNull()] | |
| [String[]] $words = $(throw "Provide word[s] to be highlighted!") |
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
| <# | |
| .Synopsis | |
| Get a Quote for any topc | |
| .DESCRIPTION | |
| Get-Quote cmdlet data harvests a/multiple quote(s) from Web outputs into your powershell console | |
| .EXAMPLE | |
| PS > Quote -Topic "success" | |
| For me success was always going to be a Lamborghini. But now I've got it, it just sits on my drive. | |
| Curtis Jackson [50 Cent], American Rapper. From his interview with Louis Gannon for Live magazine, The Mail on Sunday (UK) newspaper, (25 October 2009). | |
| .EXAMPLE |
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
| Write-Host "Quote of the Day" -ForegroundColor Yellow | |
| Get-Random "Genius","Love","Success","Failure","Intelligence" | Get-Quote |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 3 in line 1.
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
| Timestamp OnlineUsers | |
| Tuesday, March 7, 2017 12:13:30 PM 21 | |
| Tuesday, March 7, 2017 12:23:34 PM 24 | |
| Tuesday, March 7, 2017 12:33:36 PM 22 | |
| Tuesday, March 7, 2017 12:53:42 PM 17 | |
| Tuesday, March 7, 2017 1:03:45 PM 21 | |
| Tuesday, March 7, 2017 1:13:48 PM 16 | |
| Tuesday, March 7, 2017 1:33:54 PM 16 | |
| Tuesday, March 7, 2017 2:04:01 PM 15 | |
| Tuesday, March 7, 2017 2:14:04 PM 21 |
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 Get-UsersOnlineOnReddit | |
| { | |
| $OnlineUsers = (Invoke-WebRequest https://www.reddit.com/r/PowerShell/).ParsedHtml.all | ` | |
| Where-Object{ $_.classname -eq "users-online fuzzed" } | ` | |
| ForEach-Object { | |
| ($_.innertext -split " " -replace "~","")[0] | |
| } | |
| If($OnlineUsers) | |
| { |
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
| Initialize-AWSDefaults -Region us-west-2 ` | |
| -AccessKey YOUR_ACCESS_KEY ` | |
| -SecretKey YOUR_SECRET_KEY | |
| Function Get-UsersOnlineOnReddit | |
| { | |
| $OnlineUsers = (Invoke-WebRequest https://www.reddit.com/r/PowerShell/).ParsedHtml.all | ` | |
| Where-Object{ $_.classname -eq "users-online fuzzed" } | ` | |
| ForEach-Object { | |
| ($_.innertext -split " " -replace "~","")[0] |
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
| $domain = 'domain\Username' | |
| $pass = ConvertTo-SecureString -String 'somepassw@rd123' -AsPlainText -Force | |
| $creds = New-Object System.Management.Automation.pscredential -ArgumentList $domain, $pass | |
| $s = New-PSSession -ConfigurationName Microsoft.Exchange ` | |
| -ConnectionUri http://ExchangeServerName/PowerShell/ ` | |
| -Authentication Kerberos ` | |
| -Credential $creds | |
| Import-PSSession $s |
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
| [cmdletbinding()] | |
| param( | |
| [Int] $IntervalInMins = 15, | |
| [Int] $Count = 5 | |
| ) | |
| if(-not (Get-module poshtwit)) { | |
| Install-Module PoshTwit -Force -Verbose -Scope CurrentUser | |
| } |
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
| [cmdletbinding()] | |
| Param() | |
| #Adding definitions for accessing the Audio API | |
| Add-Type -TypeDefinition @' | |
| using System.Runtime.InteropServices; | |
| [Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
| interface IAudioEndpointVolume { | |
| // f(), g(), ... are unused COM method slots. Define these if you care | |
| int f(); int g(); int h(); int i(); |
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
| Test-Port -Source '127.0.0.1' -Destination '10.196.11.206','10.196.11.206','10.196.11.206','123.234.234.3' ` | |
| -Port 3389,20, 21 -Verbose | ft -AutoSize | |
| #-Iterate | Export-Csv portstatus.csv -NoTypeInformation | |
| #Test-PortConnectivity '127.0.0.1' 'dc1' 57766 -Protocol UDP -Iterate | |
| #Test-PortConnectivity 'localhost' 'dc2' 51753 -Protocol UDP | |
| #Test-PortConnectivity -Source $EUCAS -Destination $EUMBX -Port 135 -Iterate | |
| #Test-PortConnectivity -Source 'localhost' -Destination '127.0.0.1' -Port 135 -Iterate -protocol TCP | |
| Function Test-Port |