Hello. What I’m trying to do is install an application. Then once it is installed, create 2 folders and then create and modify a configuration file and put it into the last layer folder. The MSI installs with my parameters. If I manually create my subfolders, the PS script will create my file with configurations. It seems to be tripping up with creating the folders. Below is my script. I hope someone can see what I did wrong and help me to get it to work.
exit (Start-Process -FilePath 'msiexec.exe' -ArgumentList ('/qn', '/i', '"splunkforwarder-8.2.8-da25d08d5d3e-x64-release.msi" LAUNCHSPLUNK=0 AGREETOLICENSE=Yes GENRANDOMPASSWORD=1 INSTALLDIR="c:\Program Files\SplunkUniversalForwarder" SERVICESTARTTYPE=auto /quiet') -Wait -Passthru).Endscript
# Pause 1 minutes
Start-Sleep -Seconds 60
# Make 2 Directories
New-Item "c:\Program Files\SplunkUniversalForwarder\etc\apps" -Name "ks_all_deploymentclient" -ItemType "directory"
New-Item "c:\Program Files\SplunkUniversalForwarder\etc\apps\ks_all_deploymentclient" -Name "local" -ItemType "directory"
# Create the file
New-Item "c:\program files\SplunkUniversalForwarder\etc\apps\ks_all_deploymentclient\local\deploymentclient.conf"
Set-Content -Path "c:\program files\SplunkUniversalForwarder\etc\apps\ks_all_deploymentclient\local\deploymentclient.conf" '[deployment-client]
# Set the phoneHome at the end of the PS engagement
# 10 minutes
# phoneHomeIntervalInSecs = 600
# Change the targetUri
targetUri = splunk-deployment.domain.com:8089'