Skip to content

Commit 2d2cfd8

Browse files
2 parents 9039ab5 + 9171f84 commit 2d2cfd8

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# WSL Management Custom Compliance
1+
# WSL Management Custom Compliance (Preview)
22

33
This is the Intune WSL plugin installer and custom compliance script that can be used to manage WSL distros through [Windows Custom Compliance Policies and Settings](https://learn.microsoft.com/en-us/mem/intune/protect/compliance-use-custom-settings).
44

5-
The scripts are provided as samples and include no warranty, implied or otherwise.
5+
The scripts are provided as samples and include no warranty, implied or otherwise.

Linux/WSL/WSL Management Example/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WSL Management Custom Compliance - Distro and Version
1+
# WSL Management Custom Compliance - Distro and Version (Preview)
22

33
This script can be used to calculate compliance against a windows device based on WSL distros and distro versions.
44

@@ -9,7 +9,7 @@ This script can be used to calculate compliance against a windows device based o
99

1010
This is the powershell script that will run during check-in. It is written to look at the WSL distro data and confirm whether or not the registered distros and versions are in compliance based on the provided approved distros and versions.
1111

12-
Inside the shell script, you can see the following on line 41. This is the allowed distro and min and max versions, (Ubuntu 20.04 to 22.04).
12+
Inside the shell script, you can see the following on line 25. This is the allowed distro and min and max versions, (Ubuntu 20.04 to 22.04).
1313

1414
```
1515
[void]$compliantDistroValues.Add([OSCompliance]::new("Ubuntu", "20.04", "22.04"))
@@ -21,7 +21,7 @@ If we run the script interactively with only Ubuntu 20.04 registered in WSL, we
2121
{ "WSLInstancesComplianceStatus" = "Not Compliant" }
2222
```
2323

24-
You can modify the script to check allow any distros and versions that you would like as well as a last check in time requirment (Lines 39-44).
24+
You can modify the script to check allow any distros and versions that you would like as well as a last check in time requirment (Lines 23-28).
2525

2626

2727
2. WSLDetectionRule.json

Linux/WSL/WSL Management Example/WSLDistroVersionCompliance.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,6 @@
55
# Output object used for remediation
66
$jsonOutput = @{}
77

8-
# Handle plugin installation
9-
try {
10-
# Download installer
11-
Invoke-WebRequest -Uri https://github.com/befari/shell-intune-samples/raw/master/Linux/WSL/IntuneWSLPluginInstaller/IntuneWSLPluginInstaller.msi -OutFile ( New-Item -Path "C:\temp\IntuneWSLPluginInstaller.msi" -Force )
12-
13-
# Install plugin
14-
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i C:\temp\IntuneWSLPluginInstaller.msi /quiet"
15-
16-
# Delete temp file
17-
Remove-Item -path "C:\temp\IntuneWSLPluginInstaller.msi" -force
18-
}
19-
catch {
20-
$jsonOutput += @{ WSLInstancesComplianceStatus = "Error during plugin installation" }
21-
return $jsonOutput | ConvertTo-Json -Compress
22-
}
23-
248
# Class used to build compliance check values
259
class OSCompliance
2610
{
@@ -86,7 +70,7 @@ foreach($distroId in $distroIds)
8670
{
8771
$min = $compliantDistro.minVersion
8872
$max = $compliantDistro.maxVersion
89-
if ($distroVersion -lt $min -or $disroVersion -gt $max)
73+
if ($distroVersion -lt $min -or $distroVersion -gt $max)
9074
{
9175
$isCompliant = $false
9276
break

0 commit comments

Comments
 (0)