Commit d9ebd40e authored by Gabriel Moreau's avatar Gabriel Moreau
Browse files

Bad usage of hash key

parent 212ea58c
......@@ -74,24 +74,24 @@ Function TweakUninstallKasperskyEndpoint { # RESINFO
If ($Kes.IdentifyingNumber) {
Write-Host "Uninstalling Kaspersky version $($Kes.Version) with GUID => $($Kes.IdentifyingNumber)"
If ($Global:SWMB_Custom.KesPassword) {
If ($($Global:SWMB_Custom.KesPassword)) {
# Batch - password defined in clear text
$PlainPassword = $Global:SWMB_Custom.KesPassword
} ElseIf (($Global:SWMB_Custom.KesSecureString) -And (Test-Path -LiteralPath "$Global:SWMB_Custom.KesKeyFile")) {
$PlainPassword = $($Global:SWMB_Custom.KesPassword)
} ElseIf (($($Global:SWMB_Custom.KesSecureString)) -And (Test-Path -LiteralPath "$($Global:SWMB_Custom.KesKeyFile)")) {
# Batch - encrypted (blurred) password
$Password = $Global:SWMB_Custom.KesSecureString | ConvertTo-SecureString -Key (Get-Content $Global:SWMB_Custom.KesKeyFile)
$Credential = New-Object System.Management.Automation.PsCredential($Global:SWMB_Custom.KesLogin,$Password)
$Password = $($Global:SWMB_Custom.KesSecureString) | ConvertTo-SecureString -Key (Get-Content $($Global:SWMB_Custom.KesKeyFile))
$Credential = New-Object System.Management.Automation.PsCredential($($Global:SWMB_Custom.KesLogin),$Password)
$PlainPassword = $Credential.GetNetworkCredential().Password
} Else {
# Interactive - ask password
$PlainPassword = Read-Host -AsSecureString -Prompt "Give the Kaspersky endpoint password for $($Global:SWMB_Custom.KesLogin)"
$PlainPassword = Read-Host -AsSecureString -Prompt "Give the Kaspersky endpoint password for $($($Global:SWMB_Custom.KesLogin))"
}
# Uninstall
$MSIArguments = @(
"/x"
$Kes.IdentifyingNumber
"KLLOGIN=$($Global:SWMB_Custom.KesLogin)"
"KLLOGIN=$($($Global:SWMB_Custom.KesLogin))"
"KLPASSWD=$PlainPassword"
"/norestart"
"/qn"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment