diff --git a/Get-Resolution.ps1 b/Get-Resolution.ps1 new file mode 100644 index 0000000..be93e8b --- /dev/null +++ b/Get-Resolution.ps1 @@ -0,0 +1,4 @@ +# Gets the Screen resolution of a PC + +$screenResolution = hostname; Get-WmiObject -Class Win32_DesktopMonitor | Select-Object ScreenWidth,ScreenHeight +$screenResolution diff --git a/Get-RestApiOAuthToken.ps1 b/Get-RestApiOAuthToken.ps1 new file mode 100644 index 0000000..8e3b358 --- /dev/null +++ b/Get-RestApiOAuthToken.ps1 @@ -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." +} diff --git a/Get-UsersFromAllGroupsInOU.ps1 b/Get-UsersFromAllGroupsInOU.ps1 new file mode 100644 index 0000000..1755c6b --- /dev/null +++ b/Get-UsersFromAllGroupsInOU.ps1 @@ -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" diff --git a/Get-WiFiProfiles.ps1 b/Get-WiFiProfiles.ps1 new file mode 100644 index 0000000..c66fdb3 --- /dev/null +++ b/Get-WiFiProfiles.ps1 @@ -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 diff --git a/Increase-ExcangeAccountLimit.bat b/Increase-ExcangeAccountLimit.bat new file mode 100644 index 0000000..68c2540 --- /dev/null +++ b/Increase-ExcangeAccountLimit.bat @@ -0,0 +1 @@ +REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook" /v UseLargeEMSInstCtxHeap /t REG_DWORD /d "1" /f