Closed exploide closed 2 years ago
I checked on a Windows Server 2019 Standard VM but I can't reproduce the issue.
PS C:\Users\lab-user\Desktop> Invoke-WlanProfilesCheck -Verbose
VERBOSE: Exception calling "WlanOpenHandle" with "4" argument(s): "Unable to find an entry point named 'WlanOpenHandle'
in DLL 'wlanapi'."
I do get the above exception though if I enable the "Verbose" mode but that's expected as the "wlanapi" doesn't exist on server editions.
However, this error is most probably caused by this part of the code:
try {
# check implementation
}
catch {
# Catch exceptions in case wlanapi doesn't exist
Write-Verbose $Error[0]
}
There is an implicit parameter binding here as Write-Verbose
expects a Message
value. The proper way to write this would be Write-Verbose -Message $Error[0]
. In your case, it seems that $Error[0]
was null, hence the error.
I "fixed" this simply by adding a null check on the exception message.
try {
# check implementation
}
catch {
if ($Error[0]) { Write-Verbose -Message $Error[0] }
}
Thank you very much :)
On a Microsoft Windows Server 2019 Standard, PrivescCheck crashed when checking wifi profiles. Running
Invoke-WlanProfilesCheck
as a standalone check reproduces this for me.