PageSourceSearch

https://pester.dev/assets/js/2d644a93.e310c387.js

js pester.dev collected 2026-10-03 19:39:00 UTC 11,593 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["4935"],{1701(e,n,s){s.r(n),s.d(n,{metadata:()=>r,default:()=>h,frontMatter:()=>t,contentTitle:()=>i,toc:()=>d,assets:()=>a});var r=JSON.parse('{"id":"introduction/installation","title":"Installation and Update","description":"Compatibility","source":"@site/versioned_docs/version-v4/introduction/installation.mdx","sourceDirName":"introduction","slug":"/introduction/installation","permalink":"/docs/v4/introduction/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/pester/docs/edit/main/versioned_docs/version-v4/introduction/installation.mdx","tags":[],"version":"v4","frontMatter":{"id":"installation","title":"Installation and Update","sidebar_label":"Installation"},"sidebar":"docs","previous":{"title":"Quick Start","permalink":"/docs/v4/quick-start"},"next":{"title":"Powershell Core","permalink":"/docs/v4/introduction/powershell-core-limitations"}}'),l=s(1987),o=s(7008);let t={id:"installation",title:"Installation and Update",sidebar_label:"Installation"},i,a={},d=[{value:"Compatibility",id:"compatibility",level:2},{value:"Installing from PSGallery Windows 10 or Windows Server 2016",id:"installing-from-psgallery-windows-10-or-windows-server-2016",level:2},{value:"Installing from PSGallery on other versions of Windows",id:"installing-from-psgallery-on-other-versions-of-windows",level:2},{value:"PowerShell 5 or newer",id:"powershell-5-or-newer",level:3},{value:"PowerShell 3 and 4",id:"powershell-3-and-4",level:3},{value:"PowerShell 2",id:"powershell-2",level:3},{value:"Installing from sources",id:"installing-from-sources",level:2},{value:"Alternative package sources",id:"alternative-package-sources",level:2},{value:"Chocolatey",id:"chocolatey",level:3},{value:"Nuget",id:"nuget",level:3}];function c(e){let n={a:"a",code:"code",em:"em",h2:"h2",h3:"h3",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.h2,{id:"compatibility",children:"Compatibility"}),"\n",(0,l.jsxs)(n.p,{children:["Pester is compatible with every version of Windows that can run at least PowerShell 2. That is ",(0,l.jsx)(n.em,{children:"Windows 10, 8, 7, Vista, XP"}),", and their respective Server versions ",(0,l.jsx)(n.em,{children:"2016, 2012 R2, 2012, 2008 R2, 2008,"})," and ",(0,l.jsx)(n.em,{children:"2003"}),"."]}),"\n",(0,l.jsx)(n.h2,{id:"installing-from-psgallery-windows-10-or-windows-server-2016",children:"Installing from PSGallery Windows 10 or Windows Server 2016"}),"\n",(0,l.jsxs)(n.p,{children:["Windows 10 and Windows Server 2016 make installing and updating PowerShell modules extremely simple by providing ",(0,l.jsx)(n.code,{children:"Install-Module"})," and ",(0,l.jsx)(n.code,{children:"Update-Module"})," cmdlets. Unfortunately there are some complications specific to Pester, that we cannot avoid."]}),"\n",(0,l.jsxs)(n.p,{children:["Pester version 3.4.0 ships as part of Windows 10 and Windows server 2016, and that distribution conflicts with the standard module update mechanism. It is not possible to update the built-in Pester to newer version, using the ",(0,l.jsx)(n.code,{children:"Update-Module"})," cmdlet."]}),"\n",(0,l.jsxs)(n.p,{children:["Instead you need to perform a new side-by-side installation of Pester, because ",(0,l.jsx)(n.code,{children:"Install-Module"})," detects the current installation of Pester is signed with a different signature than the one you are installing."]}),"\n",(0,l.jsxs)(n.p,{children:["Here's the command you need to run ",(0,l.jsx)(n.em,{children:"as administrator"})," in order to get the latest version of Pester:"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Install-Module -Name Pester -MaximumVersion 4.99 -Force\n"})}),"\n",(0,l.jsx)(n.p,{children:"Installing the module may result in this message:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"WARNING: Module 'Pester' version '3.4.0' published by\n'CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'\nwill be superceded by version '4.4.3' published by 'CN=Jakub Jare\u0161, O=Jakub Jare\u0161,\nL=Praha, C=CZ'. If you do not trust the new publisher, uninstall the module.\n"})}),"\n",(0,l.jsx)(n.p,{children:"This is because the module is signed by a different certificate than the version that Microsoft shipped with Windows."}),"\n",(0,l.jsx)(n.p,{children:"In Windows 10 v1809 and higher, you first need to cleanup the default Pester module and only then you can proceed with the installation of higher version of Pester module"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:'$module = "C:\\Program Files\\WindowsPowerShell\\Modules\\Pester"\ntakeown /F $module /A /R\nicacls $module /reset\nicacls $module /grant "*S-1-5-32-544:F" /inheritance:d /T\nRemove-Item -Path $module -Recurse -Force -Confirm:$false\n\nInstall-Module -Name Pester  -MaximumVersion 4.99 -Force\n'})}),"\n",(0,l.jsx)(n.p,{children:"For any subsequent update it is enough to run:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Update-Module -Name Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.h2,{id:"installing-from-psgallery-on-other-versions-of-windows",children:"Installing from PSGallery on other versions of Windows"}),"\n",(0,l.jsx)(n.p,{children:"The way you can install a new module differs based on the version of PowerShell you are using. Determine the version of  PowerShell you are using by running:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:'"$($PSVersionTable.PSVersion)"\n'})}),"\n",(0,l.jsx)(n.h3,{id:"powershell-5-or-newer",children:"PowerShell 5 or newer"}),"\n",(0,l.jsxs)(n.p,{children:["In version 5 or newer you can use the built-in ",(0,l.jsx)(n.code,{children:"Install-Module"})," and ",(0,l.jsx)(n.code,{children:"Update-Module"})," cmdlets coming from ",(0,l.jsx)(n.a,{href:"https://github.com/PowerShell/PowerShellGet",children:"PowerShellGet"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["From ",(0,l.jsx)(n.em,{children:"administrator"})," PowerShell command line run:"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Install-Module -Name Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.p,{children:"Or to update:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Update-Module -Name Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.h3,{id:"powershell-3-and-4",children:"PowerShell 3 and 4"}),"\n",(0,l.jsxs)(n.p,{children:["On PowerShell 3 and 4, there is no default package manager installed, but luckily PowerShellGet is available\nfor installation. See detailed ",(0,l.jsx)(n.a,{href:"https://docs.microsoft.com/en-us
1/powershell/scripting/gallery/installing-psget#for-computers-running-powershell-30-or-powershell-40",children:"instructions here"}),".\nWhen you have the package manager installed, please start a new ",(0,l.jsx)(n.em,{children:"administrator"})," PowerShell window and use:"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Install-Module -Name Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.p,{children:"Or to update:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Update-Module -Name Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.h3,{id:"powershell-2",children:"PowerShell 2"}),"\n",(0,l.jsxs)(n.p,{children:["On PowerShell 2 you can use an alternative to PowerShellGet called PSGet. See installation ",(0,l.jsx)(n.a,{href:"https://github.com/psget/psget",children:"instructions here"}),". When you have the package manager installed, please start a new ",(0,l.jsx)(n.em,{children:"administrator"})," PowerShell window and use:"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Install-Module -Module Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.p,{children:"Or to update:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"Update-Module -Module Pester -MaximumVersion 4.99\n"})}),"\n",(0,l.jsx)(n.h2,{id:"installing-from-sources",children:"Installing from sources"}),"\n",(0,l.jsxs)(n.p,{children:["To install Pester you don't have to use any package manager. You can download the sources directly at our\n",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester/releases",children:"release page"})," and copy them to your Module directory. Your module\ndirectory is most likely ",(0,l.jsx)(n.code,{children:"C:\\Program Files\\WindowsPowerShell\\Modules\\Pester"})," or ",(0,l.jsx)(n.code,{children:"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\Modules"}),"\n(on older versions of Windows), please refer to ",(0,l.jsx)(n.code,{children:"$env:PSModulePath"})," and\n",(0,l.jsx)(n.a,{href:"https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath",children:"this article"}),"\n."]}),"\n",(0,l.jsxs)(n.p,{children:["This approach can also be used to get unreleased versions of Pester, by clicking the ",(0,l.jsx)(n.code,{children:"Clone or download"})," button on the ",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester",children:"main page"}),", or ",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester/archive/refs/heads/rel/4.x.x.zip",children:"clicking this link"}),"."]}),"\n",(0,l.jsx)(n.h2,{id:"alternative-package-sources",children:"Alternative package sources"}),"\n",(0,l.jsxs)(n.p,{children:["PSGallery is the easiest way to get Pester installed to your computer, but there are alternatives. on a build server you might prefer using ",(0,l.jsx)(n.a,{href:"https://chocolatey.org/",children:"Chocolatey"}),", or  Pester to your .NET project that already uses nuget, you might prefer using Nuget.  not support pre-release versions and it needs to be initialized on first use. For those reasons you might prefer installing from other sources, especial."]}),"\n",(0,l.jsx)(n.h3,{id:"chocolatey",children:"Chocolatey"}),"\n",(0,l.jsxs)(n.p,{children:["Chocolatey (or choco) is the easiest way to ",(0,l.jsx)(n.a,{href:"https://github.com/pester/Pester#build-server-integration",children:"get Pester running on AppVeyor"}),". You avoid setting up PowerShellGet and it also supports pre-release versions."]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-powershell",children:"choco install Pester --version=4.10.1\n"})}),"\n",(0,l.jsx)(n.h3,{id:"nuget",children:"Nuget"}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.a,{href:"https://www.nuget.org/",children:"Nuget"})," is the package manager for .NET projects. Getting Pester from Nuget is useful when you are integrating PowerShell code with your .NET project, and want to have that code tested. To install use Package Manager of Visual Studio, or Package Manager Console in Visual Studio. Once you need this we are pretty sure you know 
1what you are doing. ","\u{1F642}"]})]})}function h(e={}){let{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}},7008(e,n,s){s.d(n,{R:()=>t,x:()=>i});var r=s(1763);let l={},o=r.createContext(l);function t(e){let n=r.useContext(o);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:t(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.