Skip to content

Instantly share code, notes, and snippets.

View MrWyss-MSFT's full-sized avatar

Marius Wyss MrWyss-MSFT

View GitHub Profile
@MrWyss-MSFT
MrWyss-MSFT / Get-Win32AppsOrder.ps1
Last active October 4, 2024 14:02
Reads the Apps Policy entries from the IntuneManagementExtension.log(s). Displays the date of the Apps Policy entries. For each policy entry, show the apps in the policy in order. (at least I hope so) 😊
#[scriptblock]::Create((iwr "https://gist.githubusercontent.com/MrWyss-MSFT/c52f0a4567cba24e9ac8a38416a05bac/raw").Content).Invoke()
$Path = "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\AppWorkload*.log"
$MatchPatter = '<!\[LOG\[Get policies = (.*)\]LOG\]!>'
$lines = Select-String $Path -Pattern $MatchPatter
$Apps = @()
$ln_dig = "D{0}" -f $lines.count.ToString().Length
Foreach ($line in $lines) {
@MrWyss-MSFT
MrWyss-MSFT / Get-WinGetSourcesAsCSPHtmlEncoded.ps1
Last active February 21, 2024 13:27
This script will output OMA-URI policies to enable additional sources for the Windows Package Manager (winget).
#[scriptblock]::Create((iwr "https://gist.githubusercontent.com/MrWyss-MSFT/d5805b0cfe3708adaf47d19c1d9721fd/raw").Content).Invoke()
<#PSScriptInfo
.AUTHOR MrWyss-MSFT
#>
<#
.DESCRIPTION
This script will output OMA-URI policies to enable additional sources for the Windows Package Manager (winget).
.EXAMPLE
@MrWyss-MSFT
MrWyss-MSFT / New-IntuneRegistryFavorites.ps1
Last active May 6, 2024 09:33
Saves Intune Registry Path as Favourites in Regedit
Function Get-EnrollmentID {
$baseKeyPath = 'HKLM:\SOFTWARE\Microsoft\Enrollments'
$searchValueName = 'ProviderID'
$searchValueData = 'MS DM Server'
# Get all subkeys under the base key
$subkeys = Get-ChildItem -Path $baseKeyPath -Recurse | Where-Object { $_.PSIsContainer }
# Iterate through each subkey
@MrWyss-MSFT
MrWyss-MSFT / Get-CorporateIdentifiers.ps1
Created June 5, 2024 08:28
Get the Corporate device identifiers for Intune "Manufacturer, model and serial number (Windows only)"
$ComputerSystem = Get-CimInstance -Class Win32_ComputerSystem
$Bios = Get-CimInstance -Class Win32_BIOS | Select-Object SerialNumber
$CSV = "{0},{1},{2}" -f $ComputerSystem.Manufacturer, $ComputerSystem.Model, $Bios.SerialNumber
$CSV
@MrWyss-MSFT
MrWyss-MSFT / Set-WindowsCorporateIdentifiers.ps1
Last active July 31, 2024 15:31
This script will upload the Windows Corporate Identifiers for the device to Microsoft Intune
param(
[Parameter(Mandatory = $false)]
[string]$CSVPath = "WindowsAutopilotDevices.csv", #TODO: Change back to full path
[Parameter(Mandatory = $false)]
[switch]$Force
)
#region Variables
$ScriptDirectory = Split-Path $MyInvocation.MyCommand.Path
$LogFilePath = Join-Path $ScriptDirectory "Delete-AutopilotDevices-$(Get-Date -Format yyyy-M-dd).log"
param(
[Parameter(Mandatory = $false)]
[string]$CSVPath = "WindowsAutopilotDevices.csv", #TODO: Change back to full path
[Parameter(Mandatory = $false)]
[switch]$Force
)
#region Variables
$ScriptDirectory = Split-Path $MyInvocation.MyCommand.Path
$LogFilePath = Join-Path $ScriptDirectory "Delete-AutopilotDevices-$(Get-Date -Format yyyy-M-dd).log"
@MrWyss-MSFT
MrWyss-MSFT / Wipe-IntuneDevices.ps1
Created August 5, 2024 15:04
Bulk wipe Intune devices based on a txt file
<#
.SYNOPSIS
Wipes Intune Devices from a given computers.txt List.
.DESCRIPTION
Searches the DeviceID from a given computers.txt list in Intune.
Found Devices will be wiped. There is standard output as well as a
CMTrace compatible Logfile (Wipe-IntuneDevices-yyyy-m-dd.log)
will be created in the ScriptRoot.
@MrWyss-MSFT
MrWyss-MSFT / Delete-UnusedIntuneApps.ps1
Last active September 10, 2024 13:35
Lists not assigned apps Intune Win32Apps for the user to delete.
<#
.SYNOPSIS
Lists not assigned apps Intune Win32Apps for the user to delete.
.DESCRIPTION
Lists all apps that are not assigned and are Win32 Apps.
The user can select the apps to delete. There is standard output as well as a
CMTrace compatible Logfile (Delete-UnusedIntuneApps-yyyy-m-dd.log)
@MrWyss-MSFT
MrWyss-MSFT / Get-DeliveryOptimizationStatusHumanReadable.ps1
Last active October 18, 2024 09:58
Get-DeliveryOptimizationStatusHumanReadable
Get-DeliveryOptimizationStatus |
Select PredefinedCallerApplication,
@{Name="SourceURL";Expression={$_."SourceURL" -replace '^.*/',''}},
DownloadMode,
@{Name="FileSizeMB";Expression={[math]::round($_.FileSize / 1MB, 2)}},
@{Name="FileSizeInCacheMB";Expression={[math]::round($_.FileSizeInCache / 1MB, 2)}},
@{Name="TotalBytesDownloadedMB";Expression={[math]::round($_.TotalBytesDownloaded / 1MB, 2)}},
@{Name="BytesFromPeersMB";Expression={[math]::round($_.BytesFromPeers / 1MB, 2)}},
@{Name="BytesFromHttpMB";Expression={[math]::round($_.BytesFromHttp / 1MB, 2)}},
HttpConnectionCount,