Friday, September 19, 2025

Deploy a Scheduled Task in Intune


Unlike with GPOs / GPPs, Intune doesn't currently have a configuration profile option to deploy a scheduled task (ST).

The alternative is to deploy powershell scripts with a ST definition XML file in a Win32 App.

Manually create the ST.  Don't worry if you can't set it to SYSTEM and run while users logged off on the manually configured one.  This corrects itself during the export / import process.

Export the ST to a XML file.

Delete the manually created ST and import it back to check it imports correctly.

The import/install powershell looks like this.  Save it to a powershell file in the same folder as the XML

e.g. install.ps1

$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$STImportFile = Join-Path $scriptDir "<STDefinition.xml>"

Register-ScheduledTask -TaskName "<TS Name>" -xml (Get-Content $STImportFile | Out-String)


The removal/uninstall powershell is simply this.  Save it to a powershell file in the same folder as the XML

e.g. uninstall.ps1

Unregister-ScheduledTask -TaskName "<TS Name>" -Confirm:$false


Create a detection powershell script for Intune detection.  Test it as with admin credentials.

$taskName = "<TS Name>"
$taskStatus = Get-ScheduledTask | ?{$_.TaskName -eq $taskName}
if ($taskStatus)
    {Exit 0}
    else
    {Exit 1}


That's the file set.  Use the IntuneWinAppUtil to create the uploadable Intune format.  For the -s switch just point to the Installation powershell script file.

Finally create an Intune Win32 app for deployment and upload the .intune file as the source.

Configure the install and uninstall commands as

powershell -executionpolicy bypasss -file .\install.ps1

powershell -executionpolicy bypasss -file .\uninstall.ps1

Upload the detection powershell script at the detection app setup stage.


Tuesday, September 16, 2025

Excel Duplicate checks

 This formula checks a columns in a list for duplicates.  In this case the column header of the column being checked is called MachineName.  This formula is put in each cell of the adjacent column and identifies if each entry is unique or a duplicate

=IF(COUNTIFS([MachineName], [@MachineName]) > 1, "Duplicate", "Unique")




Monday, September 8, 2025

Specify a custom MDM Diagnostics log

 

Intune collects a ton of logs from MDM Diagnostics, but what about the other logs that aren't in collected as standard?

Add an entry under this key

HKLM\SOFTWARE\Microsoft\MdmDiagnostics\Area\DeviceProvisioning\FileEntry

example

%windir%Temp\*Installer*      REG_DWORD    0x000000ff (255)


This makes the diagnostics collect files matching the wild cards.

In the diagnostics they are compressed in a mdmlogs-<date>.cab file in the folder which includes the name  ...MDMDiagnostics_mdmlogs-<date reference>