From 3208a5335b5f27873c877743c702243ccdf33730 Mon Sep 17 00:00:00 2001 From: poslop Date: Thu, 13 Feb 2025 11:32:13 -0600 Subject: [PATCH] testing new script --- scripts/DeleteOldProfilesManual.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/DeleteOldProfilesManual.ps1 b/scripts/DeleteOldProfilesManual.ps1 index bd7fd72..cfb69ec 100644 --- a/scripts/DeleteOldProfilesManual.ps1 +++ b/scripts/DeleteOldProfilesManual.ps1 @@ -7,15 +7,13 @@ $InactiveDays = 14 $ComputerName = $env:computername -Set-strictmode -version latest ForEach ($computer in $ComputerName) { $profilesFound = 0 - $profiles = Get-CimInstance -Class Win32_UserProfile -Computer $computer Try { - $profiles = Get-CimInstance -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges + $profiles = Get-WmiObject -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges } Catch { Write-Warning "Failed to retreive user profiles on $ComputerName" Exit