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

Installing VS2012 silently with PS on Win7 works, on Server 2008 doesn't. "Start-Process : The system cannot find the file specified."

$
0
0

When installing VS2012 silently with PS on Win7, I don't get any errors. On the Server 2008, it tells me, that it can't find the file specified, even though I can write the path into my PS window. The following is the script I'm using:

Write-Host "Installing Visual Studio 2012..."

#Installation

$mypath = Split-Path $MyInvocation.MyCommand.Path #Bestimmt den Ort des Scripts und geht einen Ordner nach oben (Split-Path), dieser wird dann unter $a gespeichert.
$installdir = Join-Path (Split-Path(Split-Path(Split-Path(Split-Path(Split-Path(Split-Path $MyInvocation.MyCommand.Path)))))) "\Installationsfiles" #Hier wird der Überordner für das Installationsfile festgelegt.
$config = [xml] (get-content (Join-Path (Split-Path(Split-Path $mypath)) install.xml)) #Liest die Konfigurationsdatei aus (den Inhalt).
$u = $env:HOMESHARE #Der Ordner für den lokalen User wird hier definiert.
$install = Join-Path $installdir "\VisualStudio 2012\VS2012\vs_ultimate.exe" #Speichert den Dateipfad unter $install.
$adminfile = Join-Path $installdir "\VisualStudio 2012\VS2012\AdminDeployment.xml" #Speichert das Adminfile für den späteren Gebrauch.
Write-Host $adminfile
Write-Host $install
Start-Process -FilePath $install -ArgumentList "/adminfile $adminfile /quiet /norestart" -Wait -Verb RunAs #Startet die automatische Installation (-ArgumentList), akzeptiert alle Warnungen (-Verb RunAs) und wartet, bis die Installation vorbei ist (-Wait). Damit der Pfad auch als Pfad gelesen wird, muss das Urgument in Double-Quotes und nicht Single-Quotes gesetzt sein.

#Configuration

$ld = Join-Path $u 'Documents\Visual Studio 2012\Settings' #Der Zielordner für die Konfigurationsdatei wird hier definiert.
Copy-Item (Join-Path $mypath "\CurrentSettings.vssettings") -Destination $ld #Die Datei wird anschliessend in den Zielordner kopiert (und ersetzt den vorhandenen).
Write-Host -Fore Green "Visual Studio 2012 installed..."

And this is, what the PS window is showing:


The following is my signature:

Powershell Programmer & Advanced Lua Programmer

Location: Switzerland

Beside that, whenever you see a reply, you think is helpful, click "Vote As Helpful"! And whenever you see a reply being an answer to the main question of the thread, click "Mark As Answer" (if you opened the thread).

I published the URL's for the icons in my signature.

Please contact me, before reporting me, thank you.

[string](0..21|%{[char][int]([int]("{0:d}" -f 0x28)+('577076797174-87661607769657424-8687168065964').substring(($_*2),2))})-replace' '

Viewing all articles
Browse latest Browse all 2562

Trending Articles