You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Powershell advices - Error: Cannot index into a null array.
Error in method invocation because [System.String] does not contain a method named 'ConvertLargeIntegerToInt64'.
PosibleFix:
Change the function Get-ObservationWindow on lines 565/572 to
function Get-ObservationWindow($DomainEntry)
{
# Check if $DomainEntry is null
if ($null -eq $DomainEntry) {
Write-Host "Error: DomainEntry is null."
return $null
}
# Check if 'Properties' exists and is not null
if ($null -eq $DomainEntry.Properties) {
Write-Host "Error: Properties is null."
return $null
}
# Check if 'lockoutObservationWindow' exists in the object's properties
if ($DomainEntry.Properties.ContainsKey('lockoutObservationWindow')) {
# Get the value of the 'lockoutObservationWindow' attribute
$lockObservationWindow_attr = $DomainEntry.Properties['lockoutObservationWindow']
# Check if the attribute has an assigned value
if ($null -ne $lockObservationWindow_attr -and $lockObservationWindow_attr.Count -gt 0) {
# Convert the value from LargeInteger to TimeSpan
$observation_window = [System.TimeSpan]::FromTicks($lockObservationWindow_attr.Value)
# Return the observation window in minutes
return $observation_window.TotalMinutes
} else {
Write-Host "lockoutObservationWindow attribute has no value."
return $null
}
} else {
Write-Host "lockoutObservationWindow attribute not found."
return $null
}
}
I am not sure if it modifies much the behavior of the original function but it seems to work.
Feel free to modify it and comment
Also on line 265 be sure you´ve changed the parameter $Message to ${Message}
The text was updated successfully, but these errors were encountered:
Errors when using -Verbose on lines 565/572
Powershell advices -
Error: Cannot index into a null array.
Error in method invocation because [System.String] does not contain a method named 'ConvertLargeIntegerToInt64'.
PosibleFix:
Change the function Get-ObservationWindow on lines 565/572 to
I am not sure if it modifies much the behavior of the original function but it seems to work.
Feel free to modify it and comment
Also on line 265 be sure you´ve changed the parameter
$Message to ${Message}
The text was updated successfully, but these errors were encountered: