Reputation: 1
Cheers Smart-People of the Internet.
Deploy different Windows version & Software via MDT. One of the Softwares is a Monitoring-Software. The Provider of the Monitoring-Software offers me per location my customer has one MSI-file i can install to directly assign a maschine to it. So i build two Powershell-Script. One Script which is only on a more secured Server, which gathers and drops all the installers into folder on a NAS. And one script which is ment for the operator (trainee) who is deploying the OS via MDT onto the maschine. The script gets called by MDTs TaskSequenz and the operator gets a prompt with a table conainting all the customers and they locations from which they can select what customers maschine is currently prept.
the script calles a MSI file from my NAS. Sometimes it executes corretly and installs the Monitoring-Software sometimes it doesnt. When it doesnt it just starts MSIEXEC, pops open the installation Windows and closes it after a second or so. No errors get displayed by MSIEXEC or returned to Powershell.
$vtmp=($folders | Where-Object ListenID -EQ $inp1 | Select-Object Kunde,Standorte)
if($vtmp.Standorte -gt 1){
$trash=@()
$i2=1
foreach($location in $(Get-ChildItem "$($path)\$($vtmp.Kunde)"-Recurse -Directory)){
$addtrash=@{
ListenID=$i2++
Standort="$($location.Name)"
}
$trash += New-Object -TypeName psobject -Property $addtrash
}
$trash | Format-Table
$inp2=Read-Host "Select the desired Location"
## check if human input trash or usable information
while ($trash.ListenID -notcontains $inp2){
write-host -BackgroundColor Red -ForegroundColor Yellow "The entered ID is not conaited in the above list. Try again"
if($inp2 -imatch '\d[a-zA-Z]*' -or '[a-zA-Z]')
{
Write-Host "You entered LETTERS."
Write-Host -ForegroundColor Red "DONT do that."
write-Host "Only numbers listed above are allowed"
Write-Host ""
}
$inp2=Read-Host "Enter the ID of the desired Organisation"
}
##
$vtmp2=($trash | Where-Object ListenID -eq $inp2|Select-Object Standort)
$msipath=((Get-ChildItem "$path\$($vtmp.kunde)\$($vtmp2.Standort)"-File "*.msi").FullName)
}
else{
((get-childitem "$path\$($vtmp.Kunde)\" -File "*.msi" -Recurse).FullName)
}
start-process msiexec.exe -ArgumentList "/i $msipath /passive /norestart -log C:\Windows\Temp\Monitoring.log" -wait
For everyone not speaking german a short translation:
(as screenshot since it's not readble otherwise or i suck at formating text) MSIEXEC LOG
Upvotes: 0
Views: 41
Reputation: 1
Thanks to your comments Theo & mklement0 i found my error.
I forgot to set the $msipath
in the ELSE condition of if($vtmp.Standorte -gt 1)
. i did assemble the path, but never put it in the $msipath
variable. So the script tried to access a path that has not been set yet. Since there are far more customers with only one location, the script only rarely had to go the "more then one Location" path.
We tested it on a maschine (standalone as script) and within the MDT deployment multiple times.
Works just fine now. Somtimes "you can't see the forest for the trees
Upvotes: 0