testing new script
This commit is contained in:
@@ -11,9 +11,8 @@ $ComputerName = $env:computername
|
|||||||
ForEach ($computer in $ComputerName)
|
ForEach ($computer in $ComputerName)
|
||||||
{
|
{
|
||||||
$profilesFound = 0
|
$profilesFound = 0
|
||||||
|
|
||||||
Try {
|
Try {
|
||||||
$profiles = Get-WmiObject -Class Win32_UserProfile -Computer $computer -EnableAllPrivileges
|
$profiles = Get-CimInstance -Class Win32_UserProfile
|
||||||
} Catch {
|
} Catch {
|
||||||
Write-Warning "Failed to retreive user profiles on $ComputerName"
|
Write-Warning "Failed to retreive user profiles on $ComputerName"
|
||||||
Exit
|
Exit
|
||||||
@@ -27,7 +26,7 @@ ForEach ($computer in $ComputerName)
|
|||||||
$accountName = $account.value.split("\")[1]
|
$accountName = $account.value.split("\")[1]
|
||||||
$profilePath = $profile.LocalPath
|
$profilePath = $profile.LocalPath
|
||||||
$loaded = $profile.Loaded
|
$loaded = $profile.Loaded
|
||||||
$lastUseTime = [System.Management.ManagementDateTimeConverter]::ToDateTime($profile.LastUseTime)
|
$lastUseTime = $profile.LastUseTime
|
||||||
$isExcluded = $False
|
$isExcluded = $False
|
||||||
|
|
||||||
#Calculation of the login date
|
#Calculation of the login date
|
||||||
|
|||||||
Reference in New Issue
Block a user