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
$user = "USERNAME" | |
$pass = "PASSWORD" | |
$pair = "${user}:${pass}" | |
#Encode the string to the RFC2045-MIME variant of Base64, except not limited to 76 char/line. | |
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) | |
$base64 = [System.Convert]::ToBase64String($bytes) | |
#Create the Auth value as the method, a space, and then the encoded pair Method Base64String | |
$basicAuthValue = "Basic $base64" |
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
Get-ADObject -Filter * -Properties * | where {$_.objectsid -eq "REPLACE-WITH-SID"} | fl cn,objectclass,objectsid |
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
# Get all books from http://books.goalkicker.com/ | |
$links = Invoke-WebRequest http://books.goalkicker.com/ | Select-Object -ExpandProperty links | where {$_.href -notlike "*tweet*"} | Select-Object -ExpandProperty href | Sort-Object | |
foreach ($l in $links) { | |
$books = Invoke-WebRequest http://books.goalkicker.com/$l | Select-Object -ExpandProperty links | Where-Object {$_.href -like "*Pro*.pdf" -and $_.href -notlike "about*" } | Select-Object -ExpandProperty href | |
foreach ($book in $books) { | |
Invoke-WebRequest http://books.goalkicker.com/$l/$book -OutFile C:\backup\Learnings\$book | |
} |
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
$ProcessParameters = @{ | |
FilePath = "C:\Users\xxx\AppData\Local\UiPath\app-18.1.2\UiRobot.exe" | |
ArgumentList = @( | |
'/file:"C:\Users\xxx\Documents\UiPath\test\Main.xaml"' | |
"/input:`"{'arg1':'$Var'}`"" | |
) | |
NoNewWindow = $true | |
Wait = $true | |
} | |
Start-Process @ProcessParameters |
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
$numbers = @(4..6) | |
foreach ($num in $numbers) { | |
$WebRequest = Invoke-WebRequest "http://sonlite.dnr.state.la.us/sundown/cart_prod/cart_con_pshmonprod2?p_beg_date=2018&p_parish_code=0$num" | |
$results = @() | |
## Extract the tables out of the web request | |
$tables = @($WebRequest.ParsedHtml.getElementsByTagName("TABLE")) | |
$table = $tables[0] | |
$titles = @() |
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
Import-Module SharePointPnPPowerShell2013 -DisableNameChecking | |
Connect-PnPOnline -Url "https://sharepoint/sites/mainsitepage" -CurrentCredentials # if logged into domain | |
$list = Get-PnPList -Identity "917d9483-d6c4-4f47-8f88-4beac30df4a1" ## Tip: Use Get-PnPlist with no identity to find your list ID | |
$context = Get-PnPContext | |
$web = $context.web | |
$context.Load($web) | |
$fields = $list.Fields | |
$context.Load($fields) | |
$query = New-Object Microsoft.SharePoint.Client.CamlQuery | |
$items = $list.GetItems($query) |
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
(1..100) | % { | |
if (($_ % 5 -eq 0) -and ($_ % 3 -eq 0)) {"FizzBuzz"} | |
else { | |
if ($_ % 3 -eq 0) {"Fizz"} | |
elseif ($_ % 5 -eq 0) {"Buzz"} | |
else {$_} | |
} | |
} |
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
### assuming mailboxes.txt has full primary addresses or primary alias names | |
$mailboxes = get-content mailboxes.txt | |
$mailboxes | % { | |
$name = Get-Mailbox $_ | select -ExpandProperty alias | |
Set-Mailbox $_ -EmailAddresses SMTP:[email protected],[email protected] -WhatIf | |
} |
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
### Start security settings ### | |
### If server's SSL cert is invalid/not trusted, we need to ignore the cert for Invoke-WebRequest | |
function Ignore-SSLCertificates | |
{ | |
$Provider = New-Object Microsoft.CSharp.CSharpCodeProvider | |
$Compiler = $Provider.CreateCompiler() | |
$Params = New-Object System.CodeDom.Compiler.CompilerParameters | |
$Params.GenerateExecutable = $false | |
$Params.GenerateInMemory = $true |
OlderNewer