How To Install Windows Service Using Powershell

If version 5 or above, confirm you are running PowerShell as administrator and continue with: Install-Module PSWindowsUpdate Get-Command –module PSWindowsUpdate Then you will need to register to use the Microsoft Update Service not just the default Windows Update Service. Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d.
-->There are multiple ways to install PowerShell in Windows.
Prerequisites
The latest release of PowerShell is supported on Windows 7 SP1, Server 2008 R2, and later versions.
To enable PowerShell remoting over WSMan, the following prerequisites need to be met:
- Install the Universal C Runtime onWindows versions predating Windows 10. It's available via direct download or Windows Update. Fullypatched systems already have this package installed.
- Install the Windows Management Framework (WMF) 4.0 or newer on Windows 7 and Windows Server 2008R2. For more information about WMF, see WMF Overview.
Download the installer package
To install PowerShell on Windows, download the install package from our GitHub releasespage. Scroll down to the Assets section of the Release page. The Assets section may becollapsed, so you may need to click to expand it.
Installing the MSI package
The MSI file looks like PowerShell-<version>-win-<os-arch>.msi. For example:
PowerShell-7.0.0-win-x64.msiPowerShell-7.0.0-win-x86.msi
Once downloaded, double-click the installer and follow the prompts.
The installer creates a shortcut in the Windows Start Menu.
- By default the package is installed to
$env:ProgramFilesPowerShell<version> - You can launch PowerShell via the Start Menu or
$env:ProgramFilesPowerShell<version>pwsh.exe
Note
PowerShell 7 installs to a new directory and runs side-by-side with Windows PowerShell 5.1. ForPowerShell Core 6.x, PowerShell 7 is an in-place upgrade that removes PowerShell Core 6.x.
- PowerShell 7 is installed to
$env:ProgramFilesPowerShell7 - The
$env:ProgramFilesPowerShell7folder is added to$env:PATH - The
$env:ProgramFilesPowerShell6folder is deleted
If you need to run PowerShell 6 side-by-side with PowerShell 7, reinstall PowerShell 6 using theZIP install method.
Administrative install from the command line
MSI packages can be installed from the command line allowing administrators to deploy packageswithout user interaction. The MSI package includes the following properties to control theinstallation options:
- ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL - This property controls the option for adding theOpen PowerShell item to the context menu in Windows Explorer.
- ENABLE_PSREMOTING - This property controls the option for enabling PowerShell remoting duringinstallation.
- REGISTER_MANIFEST - This property controls the option for registering the Windows EventLogging manifest.
The following example shows how to silently install PowerShell with all the install options enabled.
For a full list of command-line options for Msiexec.exe, see Command line options.
Installing the MSIX package
To manually install the MSIX package on a Windows 10 client, download the MSIX package from ourGitHub releases page. Scroll down to the Assets section of the Release you want toinstall. The Assets section may be collapsed, so you may need to click to expand it.
The MSIX file looks like this - PowerShell-<version>-win-<os-arch>.msix
To install the package, you must use the Add-AppxPackage cmdlet.
Note
The MSIX package has not been released yet. When released, the package will be available in theMicrosoft Store and from the GitHub releases page.
Installing the ZIP package
PowerShell binary ZIP archives are provided to enable advanced deployment scenarios. Installing theZIP archive doesn't check the prerequisites like the MSI packages do. Download the ZIP archive fromthe releases page. Depending on how you download the file you may need to unblock thefile using the Unblock-File cmdlet. Unzip the contents to the location of your choice and runpwsh.exe from there. For remoting over WSMan to work properly, ensure that you've met theprerequisites.
Deploying on Windows 10 IoT Enterprise
Windows 10 IoT Enterprise comes with Windows PowerShell, which we can use to deploy PowerShell 7.
Create
PSSessionto target deviceCopy the ZIP package to the device
Intel r wireless wifi link 5100 driver for mac. Connect to the device and expand the archive
Set up remoting to PowerShell 7
Connect to PowerShell 7 endpoint on device
Deploying on Windows 10 IoT Core
Windows 10 IoT Core adds Windows PowerShell when you include IOT_POWERSHELL feature, which we can use to deploy PowerShell 7.The steps defined above for Windows 10 IoT Enterprise can be followed for IoT Core as well.
For adding the latest powershell in the shipping image, use Import-PSCoreRelease command to include the package in the workarea and add OPENSRC_POWERSHELL feature to your image.
Note
For ARM64 architecture, Windows Powershell is not added when you include IOT_POWERSHELL. So the zip based install will not work.You will need to use Import-PSCoreRelease command to add it in the image.
Deploying on Nano Server
These instructions assume that the Nano Server is a 'headless' OS that has a version of PowerShellis already running on it. For more information, see theNano Server Image Builder documentation.
Woowave sync pro serial killer. PowerShell binaries can be deployed using two different methods.
- Offline - Mount the Nano Server VHD and unzip the contents of the zip file to your chosenlocation within the mounted image.
- Online - Transfer the zip file over a PowerShell Session and unzip it in your chosen location.
In both cases, you need the Windows 10 x64 ZIP release package. Run the commands within an'Administrator' instance of PowerShell.
Offline Deployment of PowerShell
- Use your favorite zip utility to unzip the package to a directory within the mounted Nano Serverimage.
- Unmount the image and boot it.
- Connect to the inbox instance of Windows PowerShell.
- Follow the instructions to create a remoting endpoint using the'another instance technique'.
Online Deployment of PowerShell
Deploy PowerShell to Nano Server using the following steps.
Connect to the inbox instance of Windows PowerShell
Copy the file to the Nano Server instance
Enter the session
Extract the ZIP file
If you want WSMan-based remoting, follow the instructions to create a remoting endpoint using the'another instance technique'.
Install as a .NET Global tool
If you already have the .NET Core SDK installed, it's easy to install PowerShellas a .NET Global tool.
The dotnet tool installer adds $env:USERPROFILEdotnettools to your $env:PATH environmentvariable. However, the currently running shell doesn't have the updated $env:PATH. You can startPowerShell from a new shell by typing pwsh.
How to create a remoting endpoint
PowerShell supports the PowerShell Remoting Protocol (PSRP) over both WSMan and SSH. For moreinformation, see:
- Details
- Written by June Blender
- Last Updated: 14 November 2017
- Created: 16 November 2016
- Hits: 20951
I've been having a great time exploring the new open-source, cross-platform version of PowerShell core on my Windows PC and on my Mac (yes, I have a MacBook Air!). When I mention this to folks, they give me that crinkled look. Either they're very busy, and I understand, or they assume that open-source PowerShell is for developers. It's written in C#, it needs to be compiled and built, and it's in GitHub, which really isn't for everyone.
But, no! PowerShell 6 (officially, PowerShell 6-alpha) is for everyone! Even if you're not a developer, you can download and install it, play with it, and update it very easily. You don't need to mess with GitHub. You don't need to learn C#. You don't need to install Visual Studio. You don't need to build or compile anything.
Here's how!
The PowerShell team offers installers for the latest version of open-source PowerShell. To download an earlier version or learn how each version differs, see the Releases page.
- Go to: https://github.com/PowerShell/PowerShell. You don't need a GitHub account.
- Scroll down to the Get PowerShell section. Ignore the file list at the top of the page.
- Find your operating system and click the corresponding link in the Downloads column, then save the installation.
If you can't find your operating system in the list, you can't install PowerShell 6. Sorry!
To make sure that your downloaded installer file hasn't been tampered with or changed, verify that file hash of the downloaded file is the same as the file hash of the file that the team released.
A file hash, also known as a checksum, is a alphanumeric representation of file content that is independent of the file name or location. When the file hash of a downloaded file matches the file hash of the original, you can be confident that the content of the files is identical.
This step is completely optional, but it's a best practice when you download any file from the internet, especially a file that runs, like an exe or an installer.
To verify the file hash:
Use any of the following methods.
- Use Test-PSFileHash.ps1 (3.0+). Download the zip file and extract the script. To run it, set the value of the Path parameter to the installer file that you downloaded. The script returns True if the file hash matches; otherwise false.
-or-
- On Windows, run the Get-FileHash cmdlet (5.0+) on the installer file that you downloaded. On Mac or Linux, run any tool that gets SHA256 hashes or checksums, such as shasum.
Then, compare the value of the Hash property with the file hash listed for the installer on the Releases page.
Run the installer and accept the license agreement (after reading about it).
On Windows, by default, the installers install PowerShell 6-alpha in $env:ProgramFilesPowerShell<GitVersion>, such as C:Program FilesPowerShell6.0.0.12. Notice that the installation directory is PowerShell, not Windows PowerShell. (I get a kick out of seeing that.) Also, because the installation directory has the Git version number (aka 'GitCommitId'), you can have multiple versions of PowerShell 6-alpha installed and running side by side.
On a Mac, to allow the downloaded installer to run, ctrl-click the pkg file and click Open (unknown developer lockout).
To run PowerShell 6-alpha:
- On Windows, In the installation directory (C:Program FilesPowerShell<version>), double-click PowerShell.exe.
- On Mac, in Terminal, type powershell. For help with configuring PowerShell on a Mac, see Setting Up PowerShell on Your Mac.
Cool, eh? By default, the PowerShell 6-alpha window has a black background, so you can distinguish it from Windows PowerShell. I pin the window to my taskbar.
Congratulations and welcome to the world of open-source, cross-platform core PowerShell. There are lots of new things in this version, including a new SemanticVersion object in $PSVersionTable.PSVersion. Most importantly, the team releases a new Git version of PowerShell 6-alpha about every two weeks, so have fun with your version, but be sure to check GitHub at @SAPIENTech on Twitter for new releases.
PowerShell Studio doesn't support PowerShell 6-alpha, because it's an alpha. But you can run PowerShell Studio scripts in your PowerShell 6 window. In PowerShell Studio, right-click a script tab, click Copy File Path, and then paste the path in your PowerShell 6-alpha console. Be sure to dot-source it, if necessary.
June Blender is a technology evangelist at SAPIEN Technologies, Inc. and a Microsoft Cloud and Datacenter MVP. You can reach her at This email address is being protected from spambots. You need JavaScript enabled to view it. or follow her on Twitter at @juneb_get_help.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.