Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
param ( | |
$Username, | |
$Password, | |
$OperationType, | |
[bool] $usepagedimport, | |
$pagesize | |
) | |
#Needs reference to .NET assembly used in the script. |
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
Function DelegatedAuthN { | |
<# | |
.SYNOPSIS | |
Authenticate to Azure AD (using Delegated Auth) and receieve Access and Refresh Tokens. | |
.DESCRIPTION | |
Authenticate to Azure AD (using Delegated Auth) and receieve Access and Refresh Tokens. | |
.PARAMETER tenantID |
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
# Unifi Controller Login Base URI | |
$uController = 'yourControllerIP' # e.g 'https://192.168.1.2:8443' | |
# Identifier of the site in UniFi. Set to default for the default site | |
$uSiteID = "default" | |
$uUsername = 'adminuser' # yourAdmin UserID | |
$uPassword = 'yourPassword' # yourAdmin User Password | |
$uAuthBody = @{"username" = $uUsername; "password" = $uPassword } | |
$uHeaders = @{"Content-Type" = "application/json" } |
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
import msal | |
import jwt | |
import json | |
import sys | |
import requests | |
from datetime import datetime | |
from msal_extensions import * | |
graphURI = 'https://graph.microsoft.com' | |
tenantID = 'yourTenantID' |
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
# 1. Get API Credential via prompt. | |
# Only need the password which is your API Key | |
$gptAPI = Get-Credential | |
# 2. Export to a file in the local directory | |
$gptAPI | Export-Clixml ./chatGPTAPIKey.xml | |
# 3. Ongoing you only need to put the following two lines at the top of your scripts | |
# Make sure you copy your chatGPTAPIKey.xml file to other directories for scripts for OpenAI. | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml |
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
# 1. Import the OpenAI API Key from the local securely exported credential | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml | |
# 2. Use the Set-OpenAIKey cmdlet to take the secure credential and set the OpenAIKey environment variable | |
Set-OpenAIKey -Key $chatGPTCred.Password | |
# 3. Import the PowerShellAI Module | |
Import-Module PowerShellAI |
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
# 1. Import the OpenAI API Key from the local securely exported credential | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml | |
# 2. Use the Set-OpenAIKey cmdlet to take the secure credential and set the OpenAIKey environment variable | |
Set-OpenAIKey -Key $chatGPTCred.Password | |
# 3. Import the PowerShellAI Module | |
Import-Module PowerShellAI | |
# 4. Start the GUI |
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
# The resource URI | |
$resource = "https://graph.microsoft.com" | |
# Your Client ID and Client Secret obainted when registering your WebApp | |
$clientid = "726ec7c7-ff9e-4c28-b864-************" | |
$clientSecret = "KjYwt9tIf13kdBub7vaBJv4********************=" | |
$redirectUri = "https://localhost:8001" | |
# UrlEncode the ClientID and ClientSecret and URL's for special characters | |
$clientIDEncoded = [System.Web.HttpUtility]::UrlEncode($clientid) |
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
function BOFHExcuse { | |
# BOFH Excuse Generator | |
$first =@("Temporary","Intermittant","Partial","Redundant","Total","Multiplexed","Inherent","Duplicated","Dual-Homed","Synchronous","Bidirectional","Serial","Asynchronous","Multiple","Replicated","Non-Replicated","Unregistered","Non-Specific","Generic","Migrated","Localised","Resignalled","Dereferenced","Nullified","Aborted","Serious","Minor","Major","Extraneous","Illegal","Insufficient","Viral","Unsupported","Outmoded","Legacy","Permanent","Invalid","Deprecated","Virtual","Unreportable","Undetermined","Undiagnosable","Unfiltered","Static","Dynamic","Delayed","Immediate","Nonfatal","Fatal","Non-Valid","Unvalidated","Non-Static","Unreplicatable","Non-Serious") | |
$second = @("Array","Systems","Hardware","Software","Firmware","Backplane","Logic-Subsystem","Integrity","Subsystem","Memory","Comms","Integrity","Checksum","Protocol","Parity","Bus","Timing","Synchronisation","Topology","Transmission","Reception","Stack","Framing","Code","Programming","Peripheral |
NewerOlder