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 Get-MicrosoftGraphAccessToken { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] | |
$ClientId = "14d82eec-204b-4c2f-b7e8-296a70dab67e", # Microsoft Graph PowerShell, or your own app Id | |
[Parameter()] | |
[string] | |
$TenantId = "<YourTenantId>", | |
[Parameter()] |
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
using namespace System.Security.Cryptography.X509Certificates | |
function Get-IntuneTenantId { | |
# Check if "using namespace System.Security.Cryptography.X509Certificates" has been run | |
try | |
{ | |
$x509Store = [X509Store]::new([StoreName]::My,[StoreLocation]::LocalMachine) | |
} | |
# If not, add the required type accelerators | |
catch | |
{ |
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
#Requires -Modules Microsoft.Graph.Authentication, Microsoft.Graph.Users.Actions | |
function New-MgMailMessage { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$Subject, | |
[Parameter(Mandatory=$true)] | |
[string]$Body, | |
[Parameter(Mandatory=$false)] | |
[ValidateSet("Text", "Html")] | |
[string]$BodyType = "Text", |
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 Invoke-MgDeviceRemediationOnDemand { | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
[string[]] | |
$Computername | |
) |
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 Get-MgDeviceRemediationsStatus { | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
[string[]] | |
$Computername | |
) |
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 Get-IntuneDeviceRemediationsStatus { | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
[string[]] | |
$Computername | |
) |
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 Invoke-IntuneRemediationOnDemand { | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
[string[]] | |
$Computername | |
) |
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
class Driver { | |
[string]$WUName | |
[datetime]$InstallDate | |
[string]$DeviceName | |
[string]$FriendlyName | |
[datetime]$DriverDate | |
[string]$DriverVersion | |
[string]$Manufacturer | |
} | |
$DriverList = [System.Collections.Generic.List[Driver]]::new() |
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
Get-Package -ProviderName msu | | |
Select Name, | |
@{l='UpdateType';e={ | |
If ($_.Name -match "Antivirus" -or $_.Name -match "antimalware") | |
{"Definition Update"} | |
ElseIf ($_.Metadata.Item("SupportUrl") -match "target=hub") | |
{"Driver Update"} | |
ElseIf ($_.Summary -match "latest version of Windows") | |
{"Feature Update"} | |
ElseIf ($_.Name -match "Malicious Software Removal" -or $_.Name -match "Intelligence Update") |
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
# Example code for encrypting and decrypting secrets with .Net cryptography using either symmetric or asymmetric encryption | |
################################### | |
## SYMMETRIC ENCRYPTION ## | |
## Using AES 256-bit in CBC mode ## | |
################################### | |
# Create an AES key and Initialization vector | |
$AES = [System.Security.Cryptography.Aes]::Create() | |
$Key = [System.Convert]::ToBase64String($aes.Key) |
NewerOlder