Upload files to "/"

This commit is contained in:
aaron 2023-12-18 18:01:27 +00:00
parent 84b08e5abe
commit 7e42e74d83
5 changed files with 109 additions and 0 deletions

4
Get-Resolution.ps1 Normal file
View File

@ -0,0 +1,4 @@
# Gets the Screen resolution of a PC
$screenResolution = hostname; Get-WmiObject -Class Win32_DesktopMonitor | Select-Object ScreenWidth,ScreenHeight
$screenResolution

35
Get-RestApiOAuthToken.ps1 Normal file
View File

@ -0,0 +1,35 @@
# Generic script to get an OAuth token for a REST API
$authSuccess = $false
$authurl = "http://api_Identity_URL_Here/connect/token"
$clientId = "your_client_id"
$clientSecret = "your_client_secret"
$authboundary = [System.Guid]::NewGuid().ToString()
$authLF = "`r`n"
$authbodyLines = (
"--$authboundary",
"Content-Disposition: form-data; name=`"client_id`"$authLF",
$clientId,
"--$authboundary",
"Content-Disposition: form-data; name=`"client_secret`"$authLF",
$clientSecret,
"--$authboundary",
"Content-Disposition: form-data; name=`"grant_type`"$authLF",
"client_credentials",
"--$authboundary--"
) -join $authLF
try {
$tokenResponse = Invoke-WebRequest -Uri $authurl -Method Post -ContentType "multipart/form-data; boundary=$authboundary" -Body $authbodyLines
$tokenResponseJSON = ConvertFrom-Json $tokenResponse.Content
# Extract the token from the response
$tokenBearer = $tokenResponseJSON.token_type
$token = $tokenResponseJSON.access_token
$authSuccess = $true
"Authorized. Token is: $token"
} catch {
$authSuccess = $false
"ERROR - Unable to get an access token."
}

View File

@ -0,0 +1,41 @@
# This script is run against an OU, you'll have to edit the first variable in the script ($OU) to the OU path that you need.
# For example: $OU = "OU=Folder Permissions,OU=Security Groups,OU=MyBusiness,DC=contoso,DC=local"
# That path can be found in the Properties > Attribute Editor > distinguishedName of the OU in question:
$OU = "" # OU Path
$logPath = "C:\Logs" # Log output Path
$date = Get-Date -Format yyyy-MM-dd
$name = (((($OU -split "=")[1] -split ",")[0]) -replace '\s','') -replace '\W',''
$groups = Get-ADGroup -Filter * -SearchBase $OU
$groupsMembers = ForEach ($group in $groups){
#$group.Name
$members = Get-ADGroupMember -Identity $group
$groupMembers = [PSCustomObject]@{
GroupName = $group.Name
Members = $members.Name
}
$groupMembers
}
$groupsMembers = $groupsMembers | Sort-Object -Property GroupName
$groupsMembers1 = ForEach ($group in $groupsMembers){
$group1 = [PSCustomObject]@{
GroupName = $group.GroupName
Members = $null
}
$group1
$group.Members = $group.Members | Sort-Object
ForEach ($member in $group.Members){
$group2 = [PSCustomObject]@{
GroupName = $null
Members = $member
}
$group2
}
}
New-Item -ItemType Directory -Force -Path $logPath
$groupsMembers1 | ConvertTo-Html -Property GroupName, Members | Out-File "$logPath\$date-$name-GroupMembers.html"

28
Get-WiFiProfiles.ps1 Normal file
View File

@ -0,0 +1,28 @@
# Gets all the WiFi profiles stored on a PC, including passwords
$wifi = $(netsh.exe wlan show profiles)
if ($wifi -match "There is no wireless interface on the system."){
Write-Output $wifi
exit
}
$SSIDs = ($wifi | Select-string -pattern "\w*All User Profile.*: (.*)" -allmatches).Matches | ForEach-Object {$_.Groups[1].Value}
$SSIDsPassphrases =
foreach ($SSID in $SSIDs){
try {
$passphrase = ($(netsh.exe wlan show profiles name="$SSID" key=clear) |
Select-String -Pattern ".*Key Content.*:(.*)" -AllMatches).Matches |
ForEach-Object {$_.Groups[1].Value}
}
catch{
$passphrase = "N/A"
}
[PSCustomObject]@{
SSID = $SSID
Passphrase = $passphrase
}
}
Write-Output "The WiFi profiles on this System are:" $SSIDsPassphrases

View File

@ -0,0 +1 @@
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook" /v UseLargeEMSInstCtxHeap /t REG_DWORD /d "1" /f