Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

.exe-Installation via Powershell (Netlogon)

$
0
0

Hallo zusammen,

ich habe folgendes Problem: Wir wollen Software mittels Netlogon deployen (über ein .ps1-Skript), jedoch reicht es nicht dem Skript Credentials mitzugeben, da die .exe diese wohl nicht zieht. Demnach kann ein Administrator diese Datei generell wunderbar ausführen, das Skript läuft durch, das Programm wird installiert und sämtliche Dateien kopiert. 
Sobald man aber versucht diese Datei mittels Netlogon bei einem User ohne Adminrechte zu installieren, wirft es alle möglichen Berechtigungsprobleme. Das Problem betrifft nur .exe-Dateien, sobald eine .msi installiert wird, funktioniert es wunderbar die Credentials zu ziehen (auch bei Usern ohne Adminrechte). 

Kennt jemand das Problem? Ich habe es schon auf unterschiedlichsten Wegen probiert und wäre über jeden Tipp dankbar!

Code Softwareinstallation (läuft durch): 

$path = "xxx"
$path1 = "xxx"

$User = "xxx"
$File = "xxx"
$key = (1,2,3,4,5,6,7,8,9)
$password = Get-Content 'xxx' | ConvertTo-SecureString -key $key
$credential = New-Object System.Management.Automation.PSCredential $User,$password

$prog = 'setup.exe'
$argument = '-ms /INI="C:\software_deployment\mozilla\configuration.ini"'
$file_name1 = 'local-settings.js'
$file_name2 = 'mozilla.cfg'
$file_name3 = 'override.ini'
$file_ziel1 = 'C:\Program Files (x86)\Mozilla Firefox\defaults\pref'
$file_ziel2 = 'C:\Program Files (x86)\Mozilla Firefox\'
$file_ziel3 = 'C:\Program Files (x86)\Mozilla Firefox\browser\'
$std_ordner = 'C:\software_deployment\mozilla'
$srv_ordner = 'xxx'

$WshShell = New-Object -Com Wscript.Shell
$windir = [System.Environment]::ExpandEnvironmentVariables("%WINDIR%")

Write-Warning 'Software: Lokaler Ordner bereinigen'
$OrdnerExists = Test-Path -Path $std_ordner -Exclude *.*
If ($OrdnerExists -eq $True) {Remove-Item -Path $std_ordner -Recurse -Force}

Write-Warning 'Software: Download auf Client'
Copy-Item -Path $srv_ordner $std_ordner -recurse

Write-Warning 'Software: Installation Start'
Start-Process  $std_ordner\$prog -ArgumentList "$argument" -Wait -Verb RunAs

If ($file_name1) {Write-Warning 'Software: 1. Datei wird kopiert'; Copy-Item -Path $std_ordner\$file_name1 $file_ziel1 -Force}
If ($file_name2) {Write-Warning 'Software: 2. Datei wird kopiert'; Copy-Item -Path $std_ordner\$file_name2 $file_ziel2 -Force}
If ($file_name3) {Write-Warning 'Software: 3. Datei wird kopiert'; Copy-Item -Path $std_ordner\$file_name3 $file_ziel3 -Force}

$b = $env:appdata
$c = Join-path $b "Mozilla\Firefox\Profiles"
$d = Get-ChildItem $c
$e = "$c\$($d.name)"
$f = "$e\cert8.db"

Copy-Item $path $f
Copy-Item $path1\mozilla.cfg.js "C:\Program Files (x86)\Mozilla Firefox"
Copy-Item $path1\autoconfig.js "C:\Program Files (x86)\Mozilla Firefox\defaults\pref"



Write-Warning 'Software: Lokaler Ordner bereinigen'
Remove-Item -Path $std_ordner -Recurse -Force

Write-Warning '< ENDE >'


exit

Danke & Gruß

Maximilian


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>