The application I’m setting up to deploy is already installed on a lot of our computers, but needs to be on all computers. I would rather the script not run the installation phase if the app is already installed, and I can determine it’s installed if a certain file exists. Can I make the Toolkit look for the file and abort the installation if found? Is there another way of achieving the results I’m looking for?
Sure, Just put in an if statement near the beginning of your script, in the pre-installation section.
Something like:
If (Test-Path -Path <>) {
Exit-Script -ExitCode 0
}
1 Like
Oh right on! Perfect! Thanks.
What if I want something similar but instead of exit the script, go directly to install, so if a file or folder does not exist skip pre-install section and go to install section
Thanks
Almost the same thing:
# pre-install section
If (Test-Path -Path "<path to the file>") {
write-log "Found the file, dealing with it..."
#do stuff here
} Else {
write-log "File not found, skipping Preinstall"
}
#Install Section
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.