This file contains 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
#Checking if ToastReboot:// protocol handler is present | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -erroraction silentlycontinue | out-null | |
$ProtocolHandler = get-item 'HKCR:\ToastReboot' -erroraction 'silentlycontinue' | |
if (!$ProtocolHandler) { | |
#create handler for reboot | |
New-item 'HKCR:\ToastReboot' -force | |
set-itemproperty 'HKCR:\ToastReboot' -name '(DEFAULT)' -value 'url:ToastReboot' -force | |
set-itemproperty 'HKCR:\ToastReboot' -name 'URL Protocol' -value '' -force | |
New-item 'HKCR:\ToastReboot\Shell\Open\command' -force | |
set-itemproperty 'HKCR:\ToastReboot\Shell\Open\command' -name '(DEFAULT)' -value 'C:\Windows\System32\shutdown.exe -r -t 60' -force |
This file contains 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
#What is an API, What is REST. | |
#Some PowerShell examples, using Netsapiens. The platform behind OITVoip. | |
#Set your credentials | |
$baseurl = "https://manage.oitvoip.com/ns-api/" | |
$ClientID = '99999demo.client' | |
$Secret = 'SuperSecret' | |
$Username = 'Username' | |
$Password = 'Password' |
This file contains 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
#Run first time | |
$Exchangetoken = New-PartnerAccessToken -ApplicationId 'a0c73c16-a7e3-4564-9a95-2bdf47383716' -Scopes 'https://outlook.office365.com/.default' -Tenant $TenantID -UseDeviceAuthentication | |
write-host "Exchange Token: $($ExchangeToken.RefreshToken)" | |
#Run each following time | |
$ExchangeRefreshToken = 'ExchangeRefreshToken' | |
$UPN = "YourUPNHere@upn.com | |
$token = New-PartnerAccessToken -ApplicationId 'a0c73c16-a7e3-4564-9a95-2bdf47383716'-RefreshToken $ExchangeRefreshToken -Scopes 'https://outlook.office365.com/.default' | |
$tokenValue = "Bearer $($token.AccessToken)" |
This file contains 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
######### Secrets ######### | |
$ApplicationId = 'AppID' | |
$ApplicationSecret = 'Appsecret' | ConvertTo-SecureString -Force -AsPlainText | |
$TenantID = 'TenantID' | |
$RefreshToken = 'RefreshToken' | |
$ExchangeRefreshToken = 'ExchangeRefreshtoken' | |
$UPN = 'Upnusedtogeneratetokens' | |
$Skiplist = "One.onmicrosoft.com", "Two.onmicrosoft.com" | |
######### Secrets ######### | |
$credential = New-Object System.Management.Automation.PSCredential($ApplicationId, $ApplicationSecret) |
This file contains 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
######### Secrets ######### | |
$ApplicationId = 'AppID' | |
$ApplicationSecret = 'Appsecret' | ConvertTo-SecureString -Force -AsPlainText | |
$TenantID = 'TenantID' | |
$RefreshToken = 'RefreshToken' | |
$ExchangeRefreshToken = 'ExchangeRefreshtoken' | |
$UPN = 'Upnusedtogeneratetokens' | |
$Skiplist = "One.onmicrosoft.com", "Two.onmicrosoft.com" | |
######### Secrets ######### | |
$credential = New-Object System.Management.Automation.PSCredential($ApplicationId, $ApplicationSecret) |
This file contains 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
######### Secrets ######### | |
$ApplicationId = 'AppID' | |
$ApplicationSecret = 'AppSecret' | ConvertTo-SecureString -Force -AsPlainText | |
$RefreshToken = 'RefreshToken' | |
$APIKEy = "LangeITGlueAPIKeyHier" | |
$APIEndpoint = "https://api.eu.itglue.com" | |
######### Secrets ######### | |
$CustomerTenant = "Client.onmicrosoft.com" | |
$ITGlueORGID = "123456" | |
########################## Script Settings ############################ |
This file contains 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
$IPList = @( | |
"1.1.1.1" | |
"2.2.2.2" | |
"3.3.3.3" | |
"4.4.4.4" | |
) | |
$LocationInfo = foreach ($ip in $IPList) { | |
$Location = (Invoke-restmethod -method get -uri "https://ip2c.org/$($ip)") -split ';' | Select-Object -Last 1 |
This file contains 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
############### | |
$ITGkey = "ITGAPIKey" | |
$ITGbaseURI = "https://api.eu.itglue.com" | |
$UnifiBaseUri = "https://YourController.com:8443/api" | |
$UnifiUser = "APIUSER" | |
$UnifiPassword = "APIPAssword" | |
$FlexAssetName = "Unifi Controller Autodoc Vcampai" | |
$Description = "A network one-page document that displays the unifi status." | |
############## | |
This file contains 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
############### | |
$UnifiBaseUri = "https://Controller.com:8443/api" | |
$UnifiUser = "APIUSER" | |
$UnifiPassword = "APIPASSWORD" | |
############## | |
$UniFiCredentials = @{ | |
username = $UnifiUser | |
password = $UnifiPassword | |
remember = $true |