Hello everyone,
I’d like some help from the community. My first experience with Powershell was about 3 months ago and I’m green behind the ears so please be gentle.
We have a product at work that needs to be removed from several systems. This script will require using an encrypted password that will be passed along to an exe that I’m attempting to run within the script. I’ll be using Landesk to push the files to local machines.
# Self-elevate the script if required if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine Exit } } # Pull encrypted password from file $cred = Get-content "C:\Program Files (x86)\LANDesk\LDClient\sdmcache\ldapps\company\password.txt" | ConvertTo-SecureString -Key (1..16) $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($cred) $PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) # Launch uninstaller Start-Process -Filepath "C:\Program Files (x86)\LANDesk\LDClient\sdmcache\ldapps\company\removal.exe" UNINSTALL_PASSWORD=$PlainPassword
When I launch the script a pop up occurs called “Interactive Services Detection” with two options. 1. View Message and 2. Ask me later. When I click on view message I’m prompted with a message from the software I’m trying to remove. As you can imagine that is not the work flow I’d like my users to see. What I would to see is nothing at all except for the application to be removed.
What am I missing?
Thanks in advance and let me know if anyone needs more info.