testing new script

This commit is contained in:
poslop
2025-02-13 11:32:13 -06:00
parent 26ea01a088
commit 3208a5335b

View File

@@ -7,15 +7,13 @@ $InactiveDays = 14
$ComputerName = $env:computername $ComputerName = $env:computername
Set-strictmode -version latest
ForEach ($computer in $ComputerName) ForEach ($computer in $ComputerName)
{ {
$profilesFound = 0 $profilesFound = 0
$profiles = Get-CimInstance -Class Win32_UserProfile -Computer $computer
Try { Try {
$profiles = Get-CimInstance -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges $profiles = Get-WmiObject -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges
} Catch { } Catch {
Write-Warning "Failed to retreive user profiles on $ComputerName" Write-Warning "Failed to retreive user profiles on $ComputerName"
Exit Exit