Jump to content

Powershell 5.0 on Windows 8.0


greenhillmaniac

Recommended Posts

As you may or not know, Powershell 5.0 does not normally install on Windows 8.0. Microsoft restricted the install to Server 2012, so updating from the normal method of executing the .msu file is impossible. However, it's still possible to extract the update files and install the components individually, as these will install on 8.0 with no problem. So here's what you're going to do:

expand.exe -f:*Windows*.cab windows8-rt-kb3134759-x64_f266b1c2107b88968c4db134b9957bb61c11feb9.msu ./
expand.exe -f:* Windows8-RT-KB3134759-x64.cab .\temp
  • After this, you will have all of the update files extracted into the "temp" directory. Now comes the installation part. We want to add these individual packages into our 8.0 install:
Microsoft-Windows-PowerShell-WTR-Package
Microsoft-PowerShell-DSC-PullServer-Package
WIN8IP-Win8-Microsoft-Windows-WMI-Package
Windows-Management-Protocols-Package-Win8
Microsoft-Management-Odata-Package
Microsoft-NetworkSwitch-Management-Package
  • All we need to do is run multiple Dism commands to add packages. Here's how they look:
dism.exe /online /add-package /packagepath:(path to "temp" directory)\(packagename listed previosly)~31bf3856ad364e35~amd64~~6.2.9616.1023.mum

As an example:

dism.exe /online /add-package /packagepath:C:\temp\Microsoft-Windows-PowerShell-WTR-Package~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-PowerShell-DSC-PullServer-Package~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\WIN8IP-Win8-Microsoft-Windows-WMI-Package~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Windows-Management-Protocols-Package-Win8~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-Management-Odata-Package~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-NetworkSwitch-Management-Package~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
  • Finally we need to add the language packs, to make it all work on your OS language. The formula is similar to adding the packages on the previous step:
dism.exe /online /add-package /packagepath:(path to "temp" directory)\(packagename listed previosly)~31bf3856ad364e35~amd64~(your os language here)~6.2.9616.1023.mum

Again, using the same example as before, I have Windows 8.0 with Portuguese of Portugal as my main language, so I'll use the pt-pt numenclature:

dism.exe /online /add-package /packagepath:C:\temp\Microsoft-Windows-PowerShell-WTR-Package~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-PowerShell-DSC-PullServer-Package~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\WIN8IP-Win8-Microsoft-Windows-WMI-Package~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Windows-Management-Protocols-Package-Win8~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-Management-Odata-Package~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
dism.exe /online /add-package /packagepath:C:\temp\Microsoft-NetworkSwitch-Management-Package~31bf3856ad364e35~amd64~pt-pt~6.2.9616.1023.mum
  • After this reboot, and you'll have Powershell 5.0 fully install on your system :thumbup

powershell.jpg

NOTES:

You can do this to slipstream PS5.0 into an offline 8.0 image.

The package Microsoft-PowerShell-DSC-PullServer-Package might not install. If so, continue to install all the other packages, as Powershell 5.0 will still work.

If you don't want to use these steps, you can just simply run this script:

@echo off
rem script by: abbodi1406

%windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || (
set MESSAGE=ERROR: Run the script as administrator
goto :END
)
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
if %winbuild% NEQ 9200 (
set MESSAGE=ERROR: This package is for Windows 8
goto :END
)
%windir%\system32\reg.exe query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE | find /i "amd64" 1>nul || (
set MESSAGE=ERROR: This package is for 64-bit systems ^(x64^)
goto :END
)
if not exist "%~dp0W2K12-KB3134759-x64.msu" (
set MESSAGE=ERROR: W2K12-KB3134759-x64.msu is not found besides the script
goto :END
)
if not exist "%windir%\servicing\Packages\Microsoft-Windows-Foundation-Package*.mum" if not exist "%windir%\servicing\Packages\Microsoft-Windows-Client-Features-Package*.mum" (
set MESSAGE=ERROR: Parent foundation package is not detected
goto :END
)
if exist "%windir%\servicing\Packages\Microsoft-Windows-PowerShell-WTR-Package*6.2.9616.1023.mum" (
set MESSAGE=ERROR: This package is already installed
goto :END
)
set _mui=(ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,et-EE,fi-FI,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW)
cd /d "%~dp0"
echo.
echo Exracting the package install files..
if exist .\temp rd /s /q .\temp >nul
mkdir .\temp
expand.exe -f:*Windows*.cab W2K12-KB3134759-x64.msu .\ >nul
expand.exe -f:* Windows8-RT-KB3134759-x64.cab .\temp >nul
del /f /q Windows8-RT-KB3134759-x64.cab >nul
echo.
echo Installing main packages..
FOR %%A IN (
Microsoft-Windows-PowerShell-WTR-Package
Microsoft-PowerShell-DSC-PullServer-Package
WIN8IP-Win8-Microsoft-Windows-WMI-Package
Windows-Management-Protocols-Package-Win8
Microsoft-Management-Odata-Package
Microsoft-NetworkSwitch-Management-Package
) DO (
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\%%A~31bf3856ad364e35~amd64~~6.2.9616.1023.mum
)
if %errorlevel% neq 0 if %errorlevel% neq 3010 (
set MESSAGE=ERROR: Installing main packages failed
goto :END
)
echo.
echo Installing language packages..
for /d %%G in %_mui% do (
if exist "%windir%\System32\%%G\wuaueng.dll.mui" (
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\Microsoft-Windows-PowerShell-WTR-Package~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\Microsoft-PowerShell-DSC-PullServer-Package~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\WIN8IP-Win8-Microsoft-Windows-WMI-Package~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\Windows-Management-Protocols-Package-Win8~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\Microsoft-Management-Odata-Package~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  %windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\Microsoft-NetworkSwitch-Management-Package~31bf3856ad364e35~amd64~%%G~6.2.9616.1023.mum
  )
)
if %errorlevel% neq 0 if %errorlevel% neq 3010 (
set MESSAGE=ERROR: Installing language packages failed
goto :END
)
if %errorlevel% equ 0 (
set MESSAGE=Done
)
if %errorlevel% equ 3010 (
set MESSAGE=Done. System restart is required to complete installation
)
echo.
echo Removing temporary install files..
%windir%\System32\Dism.exe /Online /NoRestart /Add-Package /PackagePath:temp\update.mum 1>nul 2>nul
rd /s /q .\temp >nul

:END
echo.
echo ============================================================
echo %MESSAGE%.
echo ============================================================
echo.
echo Press any Key to Exit.
pause >nul
exit

All of this was possible thanks to user abbodi1406 from the MyDigitalLife forums, who knows too much about Windows updates :D

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...