[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] PowerShell script



I’ve put together a powershell script to download and install the required components to build PV drivers.

This script was created and tested using a Windows Server 2016 Standard (Desktop Experience) VM.

The script requires the dpinst.exe binaries, which are no longer shipped with WDK 10, so these must be

acquired and placed in the same location as the script.

 

Installs: python-3.5.1, git-for-windows-2.16.2 (portable), Visual Studio 2017 (Community) and WDK10

 

Script Follows (inline):

 

# Start of script

 

# Function to fetch installer and verify checksum

function DownloadAndVerify([string] $Uri, [string] $OutFile, [string] $Hash)

{

               (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile);

               if ($Hash -and ((Get-FileHash -Path $OutFile -Algorithm SHA256).Hash -ne $Hash))

                              { throw "Download hash for '$OutFile' does not match"; }

};

 

# Function to modify path perminently and in current powershell environment

function PrependEnvPath([string] $NewEntry)

{

               $OldPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path;

               $NewPath = $NewEntry + ';' + $OldPath

               Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $NewPath

               $ENV:PATH = $NewEntry + ';' + $ENV:PATH

};

 

# Create Temp folder

New-Item C:\Temp -Type Directory;

 

# Copy DPInst (x86/x64)

#New-Item C:\DPInst -Type Directory;

Copy-Item -Path .\DPInst -Destination C:\ -Recurse

[System.Environment]::SetEnvironmentVariable('DPINST_REDIST', 'C:\DPInst', 'Machine')

$ENV:DPINST_REDIST = "C:\DPInst"

 

# Create Symbol Path

New-Item C:\Symbols -Type Directory;

# could change this to a good symbol server value

[System.Environment]::SetEnvironmentVariable('SYMBOL_SERVER', 'C:\Symbols', 'Machine')

$ENV:SYMBOL_SERVER = "C:\Symbols"

 

# Install python3

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

DownloadAndVerify -Uri "https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe" `

                              -OutFile "C:\Temp\python-3.5.1.exe" `

                              -Hash "091D666239CC07906EED37AE66285ECCC831B4A00F816FE73BD4BDF1AC833B47";

Start-Process -Wait -PassThru -FilePath "C:\Temp\python-3.5.1.exe" `

                              -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1";

Remove-Item "C:\Temp\python-3.5.1.exe";

PrependEnvPath -NewEntry "C:\Program Files (x86)\Python35-32"

 

# Install git

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

DownloadAndVerify -Uri "https://github.com/git-for-windows/git/releases/download/v2.16.2.windows.1/PortableGit-2.16.2-64-bit.7z.exe" `

                              -OutFile "C:\PortableGit-2.16.2-64-bit.7z.exe" `

                              -Hash "F51853689AD8A9E30759FB263A31BCD59753B3A97272B0E76A4210528A8631A1";

Start-Process -Wait -PassThru -FilePath "C:\PortableGit-2.16.2-64-bit.7z.exe" `

                              -ArgumentList '-y -gm2 -InstallPath="C:\PortableGit"';

Remove-Item "C:\PortableGit-2.16.2-64-bit.7z.exe";

PrependEnvPath -NewEntry "C:\PortableGit\cmd"

Start-Process -Wait -PassThru -FilePath "git" -ArgumentList 'config --global user.name "winpvbuild"';

Start-Process -Wait -PassThru -FilePath "git" -ArgumentList 'config --global user.email "winpvbuild@xxxxxxxxxxxxx"';

 

# Install VS_Community

DownloadAndVerify -Uri "https://aka.ms/vscollect.exe" `

                              -OutFile "C:\Temp\vscollect.exe" `

                              -Hash "23AFB3B3E487897018E7F7C412F739D8C29C47A2359472FB4AA6FA888AE44494";

DownloadAndVerify -Uri "https://aka.ms/vs/15/release/vs_community.exe" `

                              -OutFile "C:\Temp\vs_community.exe" `

                              -Hash "F07A73AE793D69B5069BA39306E717368D6F0D005F1F4D2AFEB6A485AE19550F";

$p = Start-Process -Wait -PassThru -FilePath "C:\Temp\vs_community.exe" `

                              -ArgumentList '--quiet --nocache --wait', `

                              '--add Microsoft.VisualStudio.Workload.CoreEditor', `

                              '--add Microsoft.VisualStudio.Workload.NativeDesktop', `

                              '--add Microsoft.VisualStudio.Component.VC.CMake.Project', `

                              '--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64', `

                              '--add Microsoft.VisualStudio.Component.Static.Analysis.Tools', `

                              '--add Microsoft.VisualStudio.Component.Debugger.JustInTime', `

                              '--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop'

if (($ret = $p.ExitCode) -and ($ret -ne 3010))

               { C:\Temp\vscollect.exe; throw ('VS Install failed with exit code 0x{0:x}' -f $ret); }

Remove-Item "C:\Temp\vs_community.exe";

Remove-Item "C:\Temp\vscollect.exe";

#Remove-Item "C:\Program Files (x86)\Microsoft Visual Studio\Installer";

[System.Environment]::SetEnvironmentVariable('VS', 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community', 'Machine')

$ENV:VS = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community";

 

# Install WDK10

DownloadAndVerify -Uri "https://go.microsoft.com/fwlink/p/?linkid=859232" `

                              -OutFile "C:\Temp\wdksetup.exe" `

               -Hash "14EFBCC849E5977417E962F1CD68357D21ABF27393110B9D95983AD03FC22EF4";

Start-Process -Wait -PassThru -FilePath "C:\Temp\wdksetup.exe" `

                              -ArgumentList "/features + /quiet /ceip off";

Remove-Item "C:\Temp\wdksetup.exe";

[System.Environment]::SetEnvironmentVariable('KIT', 'C:\Program Files (x86)\Windows Kits\10', 'Machine')

$ENV:KIT = "C:\Program Files (x86)\Windows Kits\10";

 

# Hook WDK into VS2017

Start-Process -Wait -PassThru `

        -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VSIXInstaller.exe" `

        -ArgumentList "/q","/a","/skuName:Community","/skuVersion:15.0", `

                      '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"'

 

# Remove Temp folder

Remove-Item -Force -Recurse C:\Temp

 

# End of Script

_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.