Skip to content

Instantly share code, notes, and snippets.

Avatar

KelvinTegelaar

View GitHub Profile
View unifi.ps1
###############
$UnifiBaseUri = "https://Controller.com:8443/api"
$UnifiUser = "APIUSER"
$UnifiPassword = "APIPASSWORD"
##############
$UniFiCredentials = @{
username = $UnifiUser
password = $UnifiPassword
remember = $true
View voorbeeld
###############
$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."
##############
View gist:11166da33be4fc73a16c8a3b3cf5fe2d
$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
View intunemobilesync
######### 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 ############################
View adsync monitor.ps1
######### 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)
View adsync monitor.ps1
######### 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)
View example.sp1
#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)"
View PsExamplesOIT
#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'
View burntexample
#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