This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| Startet eine CMD als SYSTEM ohne PsExec. | |
| Benötigt Administratorrechte. | |
| #> | |
| # 1. C# Definition für Win32 API Aufrufe | |
| $Source = @" | |
| using System; | |
| using System.Runtime.InteropServices; |
This file contains hidden or 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
| #Requires -RunAsAdministrator | |
| #This will extract the BPRT from your unencrypted ppkg file and requests a new access token | |
| #It will fail to acquire a new access token if your BPRT is expired: AADSTS700082: The refresh token has expired due to inactivity. | |
| #Path to your ppkg file | |
| $ppkgpath = "C:\Users\admin\Documents\Windows Imaging and Configuration Designer (WICD)\Project_1\Project_1.ppkg" | |
| # Parse-JWTtoken Source https://michev.info/blog/post/2140/decode-jwt-access-and-id-tokens-via-powershell | |
| function Parse-JWTtoken { | |
| [cmdletbinding()] |
This file contains hidden or 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
| # Name der zu suchenden Gruppe | |
| $searchGroup = "DeineGruppe" | |
| # Funktion zur Überprüfung der Delegierungsrechte | |
| function Check-GPODelegation { | |
| param ( | |
| [string]$GPOName, | |
| [string]$Group | |
| ) |
This file contains hidden or 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
| # Definiere die Namen der OUs | |
| $sourceOU = "OU=A,DC=deineDomain,DC=com" | |
| $destinationOU = "OU=B,DC=deineDomain,DC=com" | |
| $gpoLinks = (Get-GPInheritance -Target (Get-ADOrganizationalUnit $sourceOU).DistinguishedName).GpoLinks | |
| foreach ($gpoLink in $gpoLinks) { | |
| $enabled = "Yes" | |
| if ($gpoLink.Enabled) { | |
| $enabled = "Yes" |
This file contains hidden or 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
| <# | |
| Microsoft.Graph and Microsoft.Graph.Beta Modules are required | |
| Install-Module Microsoft.Graph | |
| Install-Module Microsoft.Graph.Beta | |
| #> | |
| Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All" |