ugurkocde / IntuneOffboarding

https://ugurkoc.de/
MIT License
92 stars 23 forks source link

PowerShell v5.1 #2

Closed 1eyeITguy closed 1 year ago

1eyeITguy commented 1 year ago

Awesome script!! Thank you!! I'm not able to run it in PowerShell v5.1, but it works great in v7.

Here's the errors I receive in v5.1


PS C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune> .\Intune-offBoarding.ps1
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:323 char:139
+ ... indowsAutopilotDeviceIdentity -Filter "contains(serialNumber,'$($Intu ...
+                                                                 ~
Missing argument in parameter list.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:352 char:139
+ ... indowsAutopilotDeviceIdentity -Filter "contains(serialNumber,'$Search ...
+                                                                 ~
Missing argument in parameter list.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:406 char:58
+                 $deviceNamesString = $deviceNames -join ", "
+                                                          ~
Missing argument in parameter list.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:434 char:123
+ ... indowsAutopilotDeviceIdentity -Filter "contains(serialNumber,'$($Intu ...
+                                                                 ~
Missing argument in parameter list.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:496 char:44
+             Write-Host "Log file not found."
+                                            ~
The string is missing the terminator: ".
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:252 char:65
+                 if (!(Get-Module -ListAvailable -Name $module)) {
+                                                                 ~
Missing closing '}' in statement block or type definition.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:251 char:43
+             foreach ($module in $modules) {
+                                           ~
Missing closing '}' in statement block or type definition.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:242 char:13
+         try {
+             ~
Missing closing '}' in statement block or type definition.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:501 char:32
+ $Window.ShowDialog() | Out-Null
+                                ~
The Try statement is missing its Catch or Finally block.
At C:\git\azureDevOps\sysAdmins\SysAdmin_Scripts\Intune\Intune-offBoarding.ps1:241 char:33
+ $InstallModulesButton.Add_Click({
+                                 ~
Missing closing '}' in statement block or type definition.
Not all parse errors were reported.  Correct the reported errors and try again.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingArgument```
ugurkocde commented 1 year ago

Hi @1eyeITguy,

thanks for reporting this. I think I have managed to fix this bugs and PS Version 5.1 should be enough.

If you got time, please check the latest v2 script and see for yourself if it runs.

Best regards Ugur

1eyeITguy commented 1 year ago

Looks like you got it. It does open now in v5.1. I've not had it delete anything yet, but I'll do that before the end of the day.

Thank you so much, this script is VERY helpful!! Keep up the great work.