testing new script
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
[cmdletbinding(ConfirmImpact = 'High', SupportsShouldProcess=$True)]
|
[cmdletbinding(ConfirmImpact = 'High', SupportsShouldProcess=$True)]
|
||||||
|
|
||||||
$UserName = "*"
|
$UserName = "*"
|
||||||
$ExcludedUserNames = @("Administrator", "Default")
|
$ExcludedUserNames = @("Administrator", "Default Profile")
|
||||||
$InactiveDays = 14
|
$InactiveDays = 14
|
||||||
$ComputerName = $env:computername
|
$ComputerName = $env:computername
|
||||||
|
|
||||||
@@ -13,8 +13,9 @@ ForEach ($computer in $ComputerName)
|
|||||||
{
|
{
|
||||||
$profilesFound = 0
|
$profilesFound = 0
|
||||||
|
|
||||||
|
$profiles = Get-CimInstance -Class Win32_UserProfile -Computer $computer
|
||||||
Try {
|
Try {
|
||||||
$profiles = Get-WmiObject -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges
|
$profiles = Get-CimInstance -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
|
||||||
|
|||||||
Reference in New Issue
Block a user