All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
PowerShell - how can I make a script that first find the file - then run it
Hello.
I'm currently trying to clean up an old N-able AV defender installation on around 200 servers and workstations. It all the devices there n-able did not remove AV defender automatically.
Since most of the devices is workstations, there is a lot of work removing AV defender. I have to call each customer, schedule time to work on the device, then remove, then do it all over.
But all I need to do if I want to script this, is to start and run the file installer.exe.
The file is put in different folders on all devices, and it need to have access to a installer.xml that's unique for each device.
The only thing that's common on each device is this folder: "C:\Program Files\N-able Technologies\EndpointSetupInformation\"
Then they are using folders like this: {3c1c1be4-129c-485d-e43b-8183cf91c692}\ that's different for each device. And under that folder is the installer.exe and installer.xml
So how can I script that I always find the correct folder and run the correct installer.exe file?
Comments
You can start with
$path = "C:\Program Files\N-able Technologies\EndpointSetupInformation\" Get-ChildItem -Path $path -Recurse -Filter "DiffieHellman.dll" | Select DirectoryName | ft -hidetableheaders
That way you find the directories where Installer.exe is.
Check if there are an installer.xml in that directory and if it is, execute Installer.exe
@echo off
for /r "C:\Program Files\N-able Technologies\EndpointSetupInformation" %%a in (*) do if "%%~nxa"=="installer.exe" set p=%%~dpnxa
if defined p (
(start "" "%p%")
) else (
echo File not found
)
pause
This old .bat I use for job like yours may help or does it have to be powershell
Edit to check for xml
https://pastebin.com/raw/GgWgF8k7
This was closest to my solution. Better then my own, since I needed two $paths to do the job you did with one. So thank you.
wrote my first poweshell script allways worked with batch files as I am a old git
https://pastebin.com/raw/kEGwLvti
It works unless there is more than 1 installer.exe in the path