diff --git a/Changelog.md b/Changelog.md index d0aafe6..7a0d907 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,20 @@ +## Version 0.2.3 - 8/29/2025 (Fork) ## +- **SCCM Integration**: DeviceOffboardingManager will now query\offboard SCCM devices + - The SCCM console must be installed on the device that is running DeviceOffboardingManager + - User must have appropriate access to SCCM +- **Added Settings Menu** + - Toggle SCCM Management On/Off + - Toggle Automatic MS Graph authentication On/Off +- **Ability to save Encrypted JSON for Application Registration Secret for Automatic Authentication to MS Graph** + - Added button to save authentication method when using App Registration Secret + - JSON is encrypted and saved to %LOCALAPPDATA%\DeviceOffboardingManager + - Encrypted JSON is bound to the device it was created on. +- **Added Animated Loading Window** + - Animated loading menu will show when Dashboard is compiling and device searches +- **Misc** + - Updated Entra ID Icon + - Adjusted window sizes to prevent having to scroll + ## Version 0.2.2 - 7/26/2025 - **Fixed Autopilot Device Removal by Serial Number**: Enhanced offboarding process to properly retrieve and use serial numbers for Autopilot device removal (Issue #45) diff --git a/DeviceOffboardingManager.ps1 b/DeviceOffboardingManager.ps1 index 7727f1f..61fb0d9 100644 --- a/DeviceOffboardingManager.ps1 +++ b/DeviceOffboardingManager.ps1 @@ -59,6 +59,42 @@ catch { exit 1 } + +$script:LogFilePath = [System.IO.Path]::Combine($env:LOCALAPPDATA, "DeviceOffBoardingManager", "IntuneOffboardingTool_Log.txt") + +# Ensure DeviceOffBoardingManager folder exists +Write-Host "Ensuring DeviceOffBoardingManager folder exists" +$settingsFolder = [System.IO.Path]::Combine($env:LOCALAPPDATA, "DeviceOffBoardingManager") +if (-not (Test-Path $settingsFolder)) { + Write-Host "DeviceOffBoardingManager folder does not exist." + Write-Host "Creating DeviceOffBoardingManager folder at $settingsFolder" + New-Item -Path $settingsFolder -ItemType Directory | Out-Null +} + +# Create default settings.json file +$settingsPath = [System.IO.Path]::Combine($settingsFolder, "settings.json") +if (-not (Test-Path $settingsPath)) { + Write-Log -Message "Creating default settings.json file at $settingsPath" + $defaultSettings = @{ + RememberCertAuthentication = $false + RememberSecretAuthentication = $false + QuerySCCM = $true + } + $defaultSettings | ConvertTo-Json | Set-Content -Path $settingsPath +} + +function Write-Log { + param( + [Parameter(Mandatory = $true)] + [string] $Message + ) + + $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" + $logMessage = "$timestamp - $Message" + + Add-Content -Path $script:LogFilePath -Value $logMessage +} + # Function to get installed version function Get-InstalledVersion { try { @@ -69,7 +105,7 @@ function Get-InstalledVersion { return $script:PSScriptRoot.VERSION } catch { - Write-Log "Error getting installed version: $_" + Write-Log "|| Line: $($_.InvocationInfo.ScriptLineNumber) || Error getting installed version: $_" return "Unknown" } } @@ -81,7 +117,7 @@ function Get-LatestVersion { return $module.Version } catch { - Write-Log "Error getting latest version: $_" + Write-Log "|| Line: $($_.InvocationInfo.ScriptLineNumber) || Error getting latest version: $_" return "Unknown" } } @@ -184,6 +220,7 @@ if (-not ([System.Management.Automation.PSTypeName]'DeviceObject').Type) { public DateTime? AzureADLastContact { get; set; } public DateTime? IntuneLastContact { get; set; } public DateTime? AutopilotLastContact { get; set; } + public DateTime? SCCMLastContact { get; set; } public event PropertyChangedEventHandler PropertyChanged; @@ -272,7 +309,7 @@ function ConvertTo-SafeDateTime { return $parsedDate } catch { - Write-Log "Failed to parse date: $dateString" + Write-Log "|| Line: $($_.InvocationInfo.ScriptLineNumber) || Failed to parse date: $dateString" return $null } } @@ -282,10 +319,10 @@ function ConvertTo-SafeDateTime { + ResizeMode="CanResize"> @@ -788,6 +825,11 @@ function ConvertTo-SafeDateTime {