poshBAR

Syntax

Add-HostsFileEntry [-hostName] <String> [[-ipAddress] <String>] [[-includeLoopbackFix]] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-hostName hn The "host name" name you want routed to the target ip address. true false
-ipAddress ip The ip address of the machine you want to target. false false 127.0.0.1
-includeLoopbackFix Switch to determine if the Loopback Fix should also be applied (Add-LoopbackFix) false false False

Note

If you '-includeLoopbackFix', this method will call the 'Add-LoopbackFix' module (see Links below)

Examples

EXAMPLE 1
Add-HostsFileEntry "local.example.ca"
EXAMPLE 2
Add-HostsFileEntry "local.example.ca" "10.1.1.1"
EXAMPLE 3
Add-HostsFileEntry "local.example.ca" -includeLoopbackFix

Top of page

Links

Syntax

Add-IISHttpVerb [-verb] <String> [-siteName] <String> [[-action] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-verb The name of the verb.
valid verbs are: [GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH]
true false
-siteName sn, site The name of the website that contains this application. true false
-action Add or Remove false false add

Examples

EXAMPLE 1
Add-IISHttpVerb PUT "apps.example.ca"

Top of page

Syntax

Add-IISMimeType [-siteName] <String> [-fileExtension] <String> [-mimeType] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName sn The name of the IIS site. true false
-fileExtension extension, ext The file extension to map to the mime type. true false
-mimeType The mime type name. true false

Examples

EXAMPLE 1
Add-IISMimeType "foo.example.com" "json" "application/json"

Top of page

Add-LoopbackFix Aliases

  • loopbackFix

Syntax

Add-LoopbackFix [-siteHostName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteHostName sn The hostname that you want to loop back to the local host. true false

Note

Applies method 1 workaround fix for "You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version" (see Links below)

Examples

EXAMPLE 1
Add-LoopbackFix "local.mysite.com"

Top of page

Links

Syntax

Add-XmlConfigValue [-configFile] <String> [-xpath] <String> [-newnode] <String> [[-attributes] <Hashtable>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-configFile A path to a file that is XML based true false
-xpath Any valid XPath exression, whether result in 1 or many matches, must be an Element. true false
-newnode Any valid XML node name that you wish to add. true false
-attributes Hashtable of attributes for the new node being created false false

Examples

EXAMPLE 1
Add-ConfigValues "C:\temp\somefile.config" "//SomeNode/AnotherNode" "SomeNewNode" @{"key0"="value0";"key1"="value1"}

Top of page

Syntax

Approve-Permissions [-path] <String> [-trustee] <String> [-permission] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-path The path that you are modifying permissions on true false
-trustee The user who is being granted the specified permission true false
-permission The permission level
[full, modify, read-execute, read-only, write-only]
true false

Examples

EXAMPLE 1
Approve-Permissions 'c:\inetpub\wwwroot' 'Network Service' 'read-execute'

Top of page

Syntax

Assert-PSVersion [-requiredVersion] <Int32> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-requiredVersion The version of powershell required true false 0

Examples

EXAMPLE 1
Assert-PSVersion 4

Top of page

Assert-That Aliases

  • Assert

Syntax

Assert-That [-conditionToCheck] <Object> [-failureMessage] <Object> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-conditionToCheck The condition that you're asserting true false
-failureMessage The message to throw if the condition is not met. true false

Examples

EXAMPLE 1
Assert-That ($name -ne $null) "Name cannot be null."
EXAMPLE 2
Assert ($foo -eq $bar) '$foo and $bar must be equal.'

Top of page

Syntax

Confirm-ApplicationExists [[-siteName] <Object>] [[-appName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the assocaited IIS website false false
-appName Name of the IIS application that we're confirming. false false

Examples

EXAMPLE 1
Confirm-ApplicatonExists 'mySite' 'myApp'

Top of page

Syntax

Confirm-AppPoolExists [[-appPoolName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. false false

Examples

EXAMPLE 1
Confirm-AppPoolExists "myAppPool"

Top of page

Syntax

Confirm-SiteExists [[-siteName] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the website as it appears in IIS false false

Examples

EXAMPLE 1
Confirm-SiteExists "myWebsite.com"

Top of page

Syntax

Expand-NugetPackage [-nugetPackageName] <String> [-destinationFolder] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-nugetPackageName pkgName The full path to the Nuget package. true false
-destinationFolder dest The full path to the desired destination. true false

Examples

EXAMPLE 1
Expand-NugetPackage "something.pkg" "C:\temp\zipcontents"

Top of page

Syntax

Expand-ZipFile [-zipFileName] <String> [-destinationFolder] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-zipFileName name The full path to the zip file. true false
-destinationFolder to, dest The full path to the desired unzip location. true false

Examples

EXAMPLE 1
Expand-ZipFile "something.pkg" "C:\temp\zipcontents"

Top of page

Syntax

Find-ToolPath [-toolName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-toolName name The name of the tool to add true false

Examples

EXAMPLE 1
Find-ToolPath 'dotcover.exe'
EXAMPLE 2
Find-ToolPath 'sometool.exe'

Top of page

Format-TaskNameToHost Aliases

  • ftnhost

Syntax

Format-TaskNameToHost [-taskName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-taskName The Name of the task you are executing true false

Note

We use this in conjunction with psake for writing headers.

Examples

EXAMPLE 1
Format-TaskNameToHost "Doing Some Task"
This is a sample of how to use the method on it's own
EXAMPLE 2
FormatTaskName { param($taskName) Format-TaskNameToHost $taskName }
Input this into your psake build script to upgrade the output headers.

Top of page

Syntax

Get-Application [[-siteName] <String>] [[-appName] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the associated IIS website false false
-appName Name of the IIS application being retrieved. false false

Examples

EXAMPLE 1
Get-Application 'mySite' 'myApp'

Top of page

Syntax

Get-Applications [<CommonParameters>]

Examples

EXAMPLE 1
Get-Applications

Top of page

Syntax

Get-AppPool [[-appPoolName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. false false

Examples

EXAMPLE 1
Get-AppPool "myAppPool"

Top of page

Syntax

Get-AppPools [<CommonParameters>]

Examples

EXAMPLE 1
Get-AppPools

Top of page

Syntax

Get-EnvironmentSettings [-environment] <String> [-nodeXPath] <String> [[-environmentsPath] <String>] [[-culture] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-environment env The environment which this build is being run, these environments will match the names of the environments xml config files.
If a config file is found that matches the computer on which this is executing, it will use that instead.
true false
-nodeXPath xpath A valid XPath expression that matches the set of values you are after. true false /
-environmentsPath false false
-culture If provided will look up settings for an environment based on culture information provided. false false

Note

There MUST be a value present in the XML (even if it's empty). In order to override the value from Octopus. If it's not represented in the XML, it will not be represented in the output of this method.

Examples

EXAMPLE 1
$dbSettings = Get-EnvironmentSettings "ci" "//database"
$value = $dbSettings.connectionString

Top of page

Syntax

Get-PfxCertificate [-filePath] <String[]> [[-password] <String>] [[-x509KeyStorageFlag] <String>] [<CommonParameters>]
Get-PfxCertificate -literalPath <String[]> [[-password] <String>] [[-x509KeyStorageFlag] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-filePath A relative path to the pfx file true false
-literalPath The literal path to the pfx file true false
-password The password associated with the pfx file false false
-x509KeyStorageFlag Defines where and how to import the private key of an X.509 certificate.
Valid flags are: [DefaultKeySet, Exportable, MachineKeySet, PersistKeySet, UserKeySet, UserProtected]
false false DefaultKeySet

Note

the -x509KeyStorageFlag flag is only used if you are also passing in a -password

Examples

EXAMPLE 1
Get-PfxCertificate "$here\myCert.pfx" 'P@$$W0rd'
EXAMPLE 2
Get-PfxCertificate -literalPath "C:\certs\myCert.pfx" 'P@$$W0rd'
EXAMPLE 3
Get-PfxCertificate ".\myCert.pfx" 'P@$$W0rd' 'UserKeySet'
EXAMPLE 4
Get-PfxCertificate "$here\myCert.pfx"
This simply calls the original method
EXAMPLE 5
Get-PfxCertificate -literalPath "C:\certs\myCert.pfx"
This simply calls the original method with a literal path

Top of page

Syntax

Get-Site [-siteName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the website as it appears in IIS true false

Examples

EXAMPLE 1
Get-Site "myWebsite.com"

Top of page

Syntax

Get-Sites [<CommonParameters>]

Examples

EXAMPLE 1
Get-Sites

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-outputDir None false false
-runCommand None false false

Syntax

Get-WindowsFeatures [[-filter] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-filter Part of the feature name you would like to filter by. (not case sensitive) false false

Outputs

The output type is the type of the objects that the cmdlet emits.

  • [hashtable] - Key/Value collection where the KEY is the Windows Feature, and the value is it's state.

Note

Windows features are stored in $poshBAR:WindowsFeatures in order to improve future lookup times. Locating Windows Features is done using DISM.exe

Examples

EXAMPLE 1
Get-WindowsFeatures
EXAMPLE 2
Get-WindowsFeatures http

Top of page

Syntax

Install-WebApplication [-environment] <String> [-websiteSettings] <XmlElement> [[-version] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-environment env The environment name that the web application is being installed into. [dev, qual, uat, production] true false
-websiteSettings ws An XML node defining all of the required XML settings. An example can be found in the repository. true false
-version v The version number of the application false false

Note

The environment name should always line up with the environment names listed in your deployment tool (Octopus Deploy)

Examples

EXAMPLE 1
Install-WebApplication 'dev' $environmentSettings.websites.myWebsite '1.0.2.1234'

Top of page

Links

Syntax

Install-WindowsFeatures [[-features] <String[]>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-features The collection of Windows Features to install false false

Note

Optional features can be passed in with a trailing `?` (see Example 2). poshBAR contains an override `$poshBAR.DisableWindowsFeaturesAdministration` which when set to $true will cause this method to throw an exception when trying to install a missing Windows Feature. The purpose of this is to ensure proper change control can be maintained within your Enterprise.

Examples

EXAMPLE 1
Install-WindowsFeatures @('IIS-WebServer','IIS-WebServerRole','IIS-ISAPIFilter',  'IIS-ISAPIExtensions',  'IIS-NetFxExtensibility','IIS-ASPNET')
EXAMPLE 2
Install-WindowsFeatures 'IIS-ASPNET45?'

Top of page

Invoke-AspNetRegIIS Aliases

  • aspnet_regiis

Syntax

Invoke-AspNetRegIIS -siteName <String> [-framework <Double>] [-noRestart] [<CommonParameters>]
Invoke-AspNetRegIIS [-i] [-framework <Double>] [-noRestart] [<CommonParameters>]
Invoke-AspNetRegIIS [-ir] [-framework <Double>] [-noRestart] [<CommonParameters>]
Invoke-AspNetRegIIS [-iru] [-framework <Double>] [-noRestart] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName s Install ASP.NET to a specific site only (recommended). true false
-i Install ASP.NET and updates existing applications to use the specified version of the application pool. true false False
-ir Installs and registers ASP.NET. This option is the same as the -i option except that it does not change the CLR version associated with any existing application pools. true false False
-iru If ASP.NET is not currently registered with IIS, performs the tasks of -i. If a previous version of ASP.NET is already registered with IIS, performs the tasks of -ir. true false False
-framework The framework version to register.
Defaults to 4.0
false false 4
-noRestart Tells aspnet_regiis.exe to NOT restart IIS. false false False

Examples

EXAMPLE 1
aspnet_regiis -s example.com -norestart
EXAMPLE 2
Invoke-AspNetRegIIS -i
EXAMPLE 3
aspnet_regiis -iru -framework 3.5

Top of page

Syntax

Invoke-BlockWithTokenReplacedFile [[-fileToTokenReplace] <String>] [[-tokenValues] <Hashtable>] [[-blockToAcceptTokenReplacedFile] <ScriptBlock>] [-continuationMessage <String>] [-errorMessage <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-fileToTokenReplace File to perform token replacement on false false
-tokenValues Hashtable of key value pairs to replaced in file false false
-blockToAcceptTokenReplacedFile Block to execute with token replaced file. The block must accept the token replaced file path as the first parameter. false false
-continuationMessage Optional parameter to indicate a continuation on error with the requested message printed. false false
-errorMessage Optional parameter to indicate halt on error with the requested message printed. (Default without this parameter is to re-throw the original error) false false

Note

The file is token replaced and the contents stored in a file called "someFile.txt_tokenreplaced" (for example). This file is path is what is passed to the block. The file is automatically removed after the block is executed.

Examples

EXAMPLE 1
Invoke-BlockWithTokenReplacedFile "somePath\someFile.txt" @{ 'token1Key' = 'token1Value'; 'token2Key' = 'token2Value' } { param($tokenReplacedFile) DoSomethingWithFile $tokenReplacedFile }

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-connectionString None true false
-formatType None true false
-inputFile None true false
-targetTable None true false

Syntax

Invoke-Chutzpah [-testDirectory] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-testDirectory The directory to start the tests from. true false

Note

This module depends on the 'Find-ToolPath' module. todo: This should be expanded to take switch parameters for 'teamcity' and 'coverage'

Examples

EXAMPLE 1
Invoke-Chutzpah 'C:\Dev\MyApp\src'

Top of page

Links

Syntax

Invoke-CleanMSBuild [-projectFile] <String> [[-verbosity] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-projectFile The path to your project (.csproj) or solution (.sln) file true false
-verbosity Sets the MSBuild verbosity
- [q] = quiet
- [m] - minimal
- [n] = normal
- [d] = detailed
- [diag] = diagnostic
false false q

Examples

EXAMPLE 1
Invoke-CleanMSBuild $buildOutputDir
Cleans the solution quietly
EXAMPLE 2
Invoke-CleanMSBuild $buildOutputDir -verbosity n
Cleans the solution with the normal msbuild output

Top of page

Syntax

Invoke-Deployment [<CommonParameters>]

Examples

EXAMPLE 1
Invoke-Deployment

Top of page

Syntax

Invoke-DeployOctopusNugetPackage [-pathToPackage] <String> [-environment] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-pathToPackage The fully qualified path to your nupkg file that is being deployed true false
-environment The name of the environment that you're deploying to. true false

Examples

EXAMPLE 1
Test-DeployOctopusNugetPackage "C:\myApp\myApp.nupkg" "production"

Top of page

Invoke-Ecliptic Aliases

  • ecliptic

Syntax

Invoke-Ecliptic [[-testDir] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-testDir The directory containing test case spreadsheets false false

Note

This tools required Ecliptic to be availble within your project or $env:PATH

Examples

EXAMPLE 1
Invoke-Ecliptic 'C:/dev/myProject/src/myProject.Tests/'
EXAMPLE 2
ecliptic 'C:/dev/myProject/src/myProject.Tests/'

Top of page

Links

Syntax

Invoke-ElevatedCommand [-Scriptblock] <ScriptBlock> [[-InputObject] <Object>] [-EnableProfile] [-DisplayWindow] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-Scriptblock A script block to be executed with elevated priviledges. true false
-InputObject An optional object (of any type) to be passed in to the scriptblock (available as $input) false true (ByValue)
-EnableProfile A switch that enables powershell profile loading for the elevated command/block false false False
-DisplayWindow A switch that enables the display of the spawned process (for potential interaction) false false False

Note

Originally from "Windows PowerShell Cookbook" (O'Reilly), by Lee Holmes, September 2010 at http://poshcode.org/2179 Modified by obsidience for enhanced error-reporting, October 2010 at http://poshcode.org/2297 Modified by Tao Klerks for code formatting, enhanced/fixed error-reporting, and interaction/hanging options, January 2012 at https://gist.github.com/gists/1582185 and at http://poshcode.org/, followup to http://poshcode.org/2297 SEE ALSO: "Invoke-Elevated" (alias "su") in PSCX 2.0 - simpler "just fire" elevated process runner.

Examples

EXAMPLE 1
Invoke-ElevatedCommand {"Hello World"}
EXAMPLE 2
"test" | Invoke-ElevatedCommand {$input | Out-File -filepath c:\test.txt}
EXAMPLE 3
Invoke-ElevatedCommand {$one = 1; $zero = 0; $throwanerror = $one / $zero}

Top of page

Invoke-EntityFrameworkMigrations Aliases

  • efMigrate

Syntax

Invoke-EntityFrameworkMigrations [[-targetAssembly] <String>] [[-startupDirectory] <String>] [[-connectionString] <String>] [[-databaseName] <String>] [-dropDB] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-targetAssembly The assembly containing the Entity Framework Migrations false false
-startupDirectory If your assembly has dependencies or reads files relative to the working directory then you will need to set startupDirectory. false false
-connectionString Connection string to the database server false false
-databaseName Name of the database being migrated false false
-dropDB Should the database be dropped prior to running the migrations. This is good during integration testing. false false False

Note

This method depends on the SQLHelpers module, and the EF 'migrate.exe' (see links below).

Links

Invoke-ExternalCommand Aliases

  • Exec
  • Execute

Syntax

Invoke-ExternalCommand [-command] <ScriptBlock> [[-errorMessage] <String>] [-retry <Int32>] [-msDelay <Int32>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-command The command in the form of a script block that you want to execute. true false
-errorMessage The message you'd like to display on failure of the command.
Defaults to thrown exception if left blank.
false false
-retry The number of times to retry the command before failing. false false 0
-msDelay The number of milliseconds to delay between retries. (only applies when $retry -gt 0) false false 250

Examples

EXAMPLE 1
Exec { git st } "Error getting GIT status. Please verify GIT command-line client is installed"
EXAMPLE 2
Invoke-ExternalCommand {get st} "Error getting GIT status. Please verify GIT command-line client is installed" -retry 10 -msDelay 1000
In this example, we retry the `git st` command 10 times with a 1 second delay in between.

Top of page

Invoke-FromBase64 Aliases

  • fromBase64

Syntax

Invoke-FromBase64 [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A base64 encoded string true false

Examples

EXAMPLE 1
Invoke-FromBase64 $base64EncodedString

Top of page

Invoke-HtmlDecode Aliases

  • htmlDecode

Syntax

Invoke-HtmlDecode [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A string to be html decoded true false

Examples

EXAMPLE 1
Invoke-HtmlDecode $htmlEncodedString

Top of page

Invoke-HtmlEncode Aliases

  • htmlEncode

Syntax

Invoke-HtmlEncode [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A string to be html encoded true false

Examples

EXAMPLE 1
Invoke-HtmlEncode $myString

Top of page

Syntax

Invoke-KarmaTests [[-rootPath] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-rootPath The path to the grunt file false false

Examples

EXAMPLE 1
Invoke-KarmaTests "C:\Dev\myApp\src\myApp.Website"

Top of page

Links

Invoke-MSBuild Aliases

  • compile
  • msbuild

Syntax

Invoke-MSBuild [-outDir] <String> [-projectFile] <String> [-target <String>] [-logPath <String>] [-namespace <String>] [-visualStudioVersion <Double>] [-toolsVersion <String>] [-maxCpuCount <Int32>] [-verbosity <String>] [-warnOnArchitectureMismatch <Boolean>] [-customParameters <String[]>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-outDir The output directory for your compilation true false
-projectFile The path to your project (.csproj) or solution (.sln) file true false
-target t Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets false false build
-logPath The directory where your logs should end up false false
-namespace Used when generating build warnings. false false
-visualStudioVersion The version of Visual Studio that the solution or project was built against false false 12
-toolsVersion tv The version of the .NET framework that the solution or project targets false false 4
-maxCpuCount m Maximum number of CPU's to use during the compilation false false 1
-verbosity v, loglevel Sets the MSBuild verbosity
- [q]uiet
- [m]inimal
- [n]ormal
- [d]etailed
- [diag]nostic
false false minimal
-warnOnArchitectureMismatch Show warnings for architecture missmatch (x86 and x64) [MSB3270] false false False
-customParameters Additional msbuild parameters in array format. false false

Note

The toolset version isn't the same as the target framework, which is the version of the .NET Framework on which a project is built to run.

Examples

EXAMPLE 1
Invoke-MSBuild $buildOutputDir $solutionFile
Standard build against the defaults
EXAMPLE 2
Invoke-MSBuild $buildOutputDir $solutionFile -customParameters @('/property:SomeProperty=value')
Standard build with additional parameters.
EXAMPLE 3
Invoke-MSBuild $buildOutputDir $solutionFile -target 'clean' -logPath 'c:\logs' -namespace 'My.App.Namespace' -visualStudioVersion 11.0 -toolsVersion 4.0 -maxCpuCount 8 -verbosity 'normal' -warnOnArchitectureMismatch $true
Builds the $solutionFile with all command parameters

Top of page

Links

Syntax

Invoke-Nunit [[-targetAssembly] <String>] [[-outputDir] <String>] [[-runCommand] <String>] [[-includeCoverage] <Boolean>] [[-coverageRulesPath] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-targetAssembly The target test assembly false false
-outputDir The directory to store the output false false
-runCommand The namespace to start the tests from false false
-includeCoverage Switch to tell if we want coverage on the tests false false False
-coverageRulesPath Path to coverage rules false false

Note

Currently 'includeCoverage' invokes the DotCover coverage tool. Some day we'll need to re-think how we want to achieve this.

Examples

EXAMPLE 1
Invoke-Nunit "$buildDir\myTestAssembly.dll" "$outputDir" "myAssembly.Unit" -includeCoverage "$coverageRulesPath"

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-coverageRulesPath None false false
-outputDir None false false
-runCommand None false false
-targetAssembly None false false

Syntax

Invoke-OracleCommand [[-sqlToRun] <String>] [[-connectionString] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-sqlToRun SQL to be Executed false false
-connectionString Oracle Connection String false false

Note

SQL commands can only contain a single command, you can get around this by using BEGIN EXECUTE IMMEDIATE 'SELECT .... '; EXECUTE IMMEDIATE 'SELECT ....'; END;

Examples

EXAMPLE 1
Invoke-OracleCommand "SELECT 2*35 FROM DUAL" "Data Source=;User Id=SYSTEM;Password=xxxx"

Top of page

Links

Syntax

Invoke-OracleFile [[-sqlFile] <String>] [[-connectionString] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-sqlFile SQL script containing sql commands false false
-connectionString Oracle Connection String false false

Note

SQL commands can only contain a single command, you can get around this by using BEGIN EXECUTE IMMEDIATE 'SELECT .... '; EXECUTE IMMEDIATE 'SELECT ....'; END;

Examples

EXAMPLE 1
Invoke-OracleFile "C:\path\to\script.sql" "Data Source=;User Id=SYSTEM;Password=xxxx"

Top of page

Links

Invoke-PowershellScriptSigning Aliases

  • signscripts

Syntax

Invoke-PowershellScriptSigning [-scripts] <String[]> [[-certStorePath] <String>] [<CommonParameters>]
Invoke-PowershellScriptSigning [-scripts] <String[]> [[-pfxFilePath] <PathInfo>] [[-password] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-scripts An array of powershell scripts to be signed true false
-certStorePath Path to the certificate directory false false LocalMachine\My
-pfxFilePath File path to a .pfx certificate. false false
-password false false

Note

If using -pfxFilePath, be sure to use Resolve-Path and pass in the PathInfo object.

Examples

EXAMPLE 1
Invoke-PowershellScriptSigning @("C:\temp\someposh.ps1", "C:\otherposh.ps1")
EXAMPLE 2
Invoke-PowershellScriptSigning @("C:\temp\someposh.ps1", "C:\otherposh.ps1") "CurrentUser\My"
EXAMPLE 3
Invoke-PowershellScriptSigning @("C:\temp\someposh.ps1", "C:\otherposh.ps1") (Resolve-Path 'C:\path\to\my.pfx')

Top of page

Syntax

Invoke-SpecFlow [-testProjectFile] <String> [-testAssemblyFile] <String> [-outputDir] <String> [-runCommand] <String> [-testingFramework] <Object> [[-coverageRulesPath] <String>] [[-includeCoverage]] [[-showSpecflowReport]] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-testProjectFile the .csproj file containing your tests. true false
-testAssemblyFile The target test assembly (dll) true false
-outputDir The directory to store the output true false
-runCommand The namespace to start the tests from true false
-testingFramework Which testing framework is being leveraged (nunit & xunit supported) true false
-coverageRulesPath Path to coverage rules false false
-includeCoverage Switch to tell if we want coverage on the tests false false False
-showSpecflowReport Should the specflow report be loaded in the browser after testing is complete. false false False

Note

Currently 'includeCoverage' invokes the DotCover coverage tool. Some day we'll need to re-think how we want to achieve this.

Examples

EXAMPLE 1
Invoke-Nunit "$buildDir\myTestAssembly.dll" "$outputDir" "myAssembly.Unit" -includeCoverage "$coverageRulesPath"

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-connectionString None true false
-sqlFile None true false
-useMaster None false false

Parameters

Name Alias Description Required? Pipeline Input Default Value
-connectionString None true false
-sqlToRun None true false
-useMaster None false false

Invoke-ToBase64 Aliases

  • toBase64

Syntax

Invoke-ToBase64 [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A string to be base64 encoded true false

Examples

EXAMPLE 1
Invoke-ToBase64 $myString

Top of page

Invoke-UrlDecode Aliases

  • urlDecode

Syntax

Invoke-UrlDecode [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A string to be url decoded true false

Examples

EXAMPLE 1
Invoke-UrlDecode $urlEncodedString

Top of page

Invoke-UrlEncode Aliases

  • urlEncode

Syntax

Invoke-UrlEncode [-str] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-str A string to be url encoded true false

Examples

EXAMPLE 1
Invoke-UrlEncode $myString

Top of page

Syntax

Invoke-WebHealthCheck [-uri] <String> [[-verbs] <String[]>] [[-postData] <String>] [[-contentType] <String>] [[-timeout] <Int32>] [[-customHeaders] <Object>] [[-credentials] <NetworkCredential>] [<CommonParameters>]
Invoke-WebHealthCheck [-request] <Object> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-request An object containing all of the fields required to make a Web Health Check. This is used when storing all of the data in an XML document. A hashtable also works. true false
-uri The endpoint we are making the request to. true false
-verbs methods An array of http verbs [GET, PUT, POST, DELETE, HEAD, OPTIONS, TRACE ]. false false GET
-postData The data you would like to send with the request (will not work with GET). false false {}
-contentType The Content Type to be sent with the request. false false application/json
-timeout How long to wait before timing out the request. false false 30000
-customHeaders Any additional headers that should be sent with the request. false false
-credentials A [System.Net.NetworkCredential] object containing the credentials to be sent with the request. false false

Examples

EXAMPLE 1
Invoke-WebHealthCheck 'http://google.com' 'GET'
EXAMPLE 2
Invoke-WebHealthCheck @{uri = 'https://google.com'; verbs = 'GET'}

Top of page

Invoke-XmlDocumentTransform Aliases

  • xdt
  • XmlDocumentTransform

Syntax

Invoke-XmlDocumentTransform [-inputPathAndFile] <String> [-transformPathAndFile] <String> [[-outputPathAndFile] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-inputPathAndFile true false
-transformPathAndFile true false
-outputPathAndFile false false

Syntax

Invoke-XUnit [[-targetAssembly] <String>] [[-outputDir] <String>] [[-runCommand] <String>] [[-includeCoverage] <Boolean>] [[-coverageRulesPath] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-targetAssembly The target test assembly false false
-outputDir The directory to store the output false false
-runCommand The namespace to start the tests from false false
-includeCoverage Switch to tell if we want coverage on the tests false false False
-coverageRulesPath Path to coverage rules false false

Note

Currently 'includeCoverage' invokes the DotCover coverage tool. Some day we'll need to re-think how we want to achieve this.

Examples

EXAMPLE 1
Invoke-XUnit "$buildDir\myTestAssembly.dll" "$outputDir" "myAssembly.Unit" -includeCoverage "$coverageRulesPath"

Top of page

Syntax

Invoke-XUnitWithCoverage [[-targetAssembly] <String>] [[-outputDir] <String>] [[-runCommand] <String>] [[-coverageRulesPath] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-targetAssembly The target test assembly false false
-outputDir The directory to store the output false false
-runCommand The namespace to start the tests from false false
-coverageRulesPath Path to coverage rules false false

Note

Currently 'includeCoverage' invokes the DotCover coverage tool. Some day we'll need to re-think how we want to achieve this.

Examples

EXAMPLE 1
Invoke-XUnitWithCoverage "$buildDir\myTestAssembly.dll" "$outputDir" "myAssembly.Unit" "$coverageRulesPath"

Top of page

Lock-Object Aliases

  • Lock

Syntax

Lock-Object [-InputObject] <Object> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-InputObject The object which is to be locked. This does not necessarily need to be the actual object you want to access; it's common for an object to expose a property which is used for this purpose, such as the ICollection.SyncRoot property. true false
-ScriptBlock The script block that is to be executed while you have a lock on the object.
Note: This script block is "dot-sourced" to run in the same scope as the caller. This allows you to assign variables inside the script block and have them be available to your script or function after the end of the lock block, if desired.
true false

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None. This command does not accept pipeline input.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Object (depends on what's in the script block.)

Note

Most of the time, PowerShell code runs in a single thread. You have to go through several steps to create a situation in which multiple threads can try to access the same .NET object. In the Links section of this help topic, there is a blog post by Boe Prox which demonstrates this.

Examples

EXAMPLE 1
$hashTable = @{}; lock ($hashTable.SyncRoot) {  $hashTable.Add("Key", "Value") }
This is an example of using the "lock" alias to Lock-Object, in a manner that most closely resembles the similar C# syntax with positional parameters.
EXAMPLE 2
$hashTable = @{}; Lock-Object -InputObject $hashTable.SyncRoot -ScriptBlock { $hashTable.Add("Key", "Value")}
This is the same as Example 1, but using the full PowerShell command and parameter names.

Top of page

Links

Syntax

New-Application [-siteName] <String> [-appName] <String> [-appPath] <String> [-appPoolName] <String> [[-updateIfFound]] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName sn The name of the website that contains this application. true false
-appName an The name of the application. true false
-appPath The physical path where this application is located on disk. true false
-appPoolName The application pool that this application runs under. true false
-updateIfFound With this switch passed in, the Applications PhysicalPath will be updated to point to the new AppPath provided, otherwise, if it already exists it will just be left alone. false false False

Examples

EXAMPLE 1
New-Application "MyApp" "apps.mysite.com" "C:\inetpub\apps.mysite.com\MyApp" "MyApp"

Top of page

Syntax

New-AppPool [-appPoolName] <String> [[-appPoolIdentityType] <String>] [[-maxProcesses] <Int32>] [[-username] <String>] [[-password] <String>] [[-idleTimeout] <TimeSpan>] [[-managedPipelineMode] <String>] [[-managedRuntimeVersion] <String>] [-alwaysRunning] [-updateIfFound] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. true false
-appPoolIdentityType The type of identity you want the AppPool to run as, default is 'LocalSystem'. false false NetworkService
-maxProcesses The number of Worker Processes this AppPool should spawn, default is 1. false false 1
-username un The Username that this app pool should run as. false false
-password pwd The password for the Username that this app pool should run as. false false
-idleTimeout Amount of time a worker process will remain idle before it shuts down. false false 00:20:00
-managedPipelineMode Is the app pool to be running as 'Classic', or 'Integrated' (Defaults to Integrated) false false Integrated
-managedRuntimeVersion Runtime version for the app pool. (Defaults to v4.0) false false v4.0
-alwaysRunning Should the app pool be configured as 'Always Running' false false False
-updateIfFound If the application pool already exists, update it with the new information. false false False

Examples

EXAMPLE 1
New-AppPool "myAppPool" "NetworkService"
EXAMPLE 2
New-AppPool "myAppPool" "NetworkService" -managedPipelineMode 'Classic'

Top of page

Syntax

New-Certificate [-certData] <Hashtable> [<CommonParameters>]
New-Certificate [-name] <String> [-outPath] <String> [-key] <String> [-csr] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-certData The hashtable containing all of the required data (useful when piping calls). true true (ByValue)
-name The name associated with your new certificate true false
-outPath out The location where your new certificate will be dropped true false
-key Name of the certificate key (name.key)
Must reside in the $outPath
true false
-csr Name of the certificate signing request (name.csr)
Must reside in the $outPath
true false

Note

Please ensure openssl.exe is available on your $env:PATH

Examples

EXAMPLE 1
New-Certificate 'cert-name' 'C:\path\to\output' 'certName.key' 'certName.csr'

Top of page

Syntax

New-CertificateSigningRequest [-certData] <Hashtable> [<CommonParameters>]
New-CertificateSigningRequest [-name] <String> [-outPath] <String> [-subject] <String> [-key] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-certData The hashtable containing all of the required data (useful when piping calls). true true (ByValue)
-name The name associated with your new certificate true false
-outPath out The location where your new certificate will be dropped true false
-subject cn true false
-key Name of the certificate key (name.key)
Must reside in the $outPath
true false

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • [hashtable] - accepts a hashtable containing the required parameters so that values can be piped from other certificate methods.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • [hashtable] - returns a hashtable containing the parameters passed in so that additional certificate methods can receive data from the pipeline.

Note

Please ensure openssl.exe is available on your $env:PATH

Examples

EXAMPLE 1
New-CertificateSigningRequest 'cert-name' 'C:\path\to\output' '/CN=bla' 'cert-name.key'

Top of page

New-NugetPackage Aliases

  • nupack

Syntax

New-NugetPackage [-nuspecFile] <String> [-version] <String> [-outputDirectory] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-nuspecFile The nuspec file used to generate the nupkg true false
-version The version of the application being packaged true false
-outputDirectory The location of the generated nupkg file true false

Note

Requires `nuget.exe` to be available on your $env:PATH Uses Find-ToolPath to try and locate nuget.exe (see Links below)

Links

Syntax

New-OracleDatabase [-schemaName] <String> [-databaseStorageFile] <String> [-schemaOwnerUserId] <String> [-schemaOwnerPassword] <String> [-connectionString] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-schemaName true false
-databaseStorageFile true false
-schemaOwnerUserId true false
-schemaOwnerPassword true false
-connectionString true false

Examples

EXAMPLE 1
New-OracleDatabase 'MyDatabase' 'C:\databases\MyDatabase.dbf' 'MyUser' 'MyUserPassword' 'Data Source=localhost/XE;User Id=system;Password=SAus3r'

Top of page

Syntax

New-PfxCertificate [-certData] <Hashtable> [-password] <String> [<CommonParameters>]
New-PfxCertificate [-outPath] <String> [-key] <String> [-crt] <String> [-name] <String> [-password] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-certData The hashtable containing all of the required data (useful when piping calls). true true (ByValue)
-outPath out The location where your new certificate will be dropped true false
-key Name of the certificate key (name.key)
Must reside in the $outPath
true false
-crt Name of the certificate (name.crt)
Must reside in the $outPath
true false
-name The name associated with your new certificate true false
-password pwd The password associated with your new certificate true false

Note

Please ensure openssl.exe is available on your $env:PATH

Examples

EXAMPLE 1
New-PfxCertificate 'c:\path\to\output' 'certName.key' 'certName.crt" 'certName' 'certP@ssword'

Top of page

Syntax

New-PrivateKey [-name] <String> [-password] <String> [-subject] <String> [-outPath] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-name The name associated with your new certificate true false
-password pwd The password associated with your new certificate true false
-subject cn The subject information associated with your new certificate true false
-outPath out The location where your new certificates will be dropped true false

Note

Please ensure openssl.exe is available on your $env:PATH

Examples

EXAMPLE 1
New-PrivateKey 'cert-name' 'certP@ssword" '/CN=bla' 'C:\path\to\output'

Top of page

Syntax

New-PrivateKeyAndCertificateSigningRequest [-name] <String> [-password] <String> [-subject] <String> [-outPath] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-name The name associated with your new certificate true false
-password pwd The password associated with your new certificate true false
-subject cn The subject information associated with your new certificate true false
-outPath out The location where your new certificates will be dropped true false

Note

Please ensure openssl.exe is available on your $env:PATH

Examples

EXAMPLE 1
New-PrivateKeyAndCertificateSigningRequest 'cert-name' 'certP@ssword" '/CN=bla' 'C:\path\to\output'

Top of page

Syntax

New-Site [-siteName] <String> [-sitePath] <String> [-bindings] <Object[]> [-appPoolName] <String> [[-updateIfFound]] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName The name of the Website that we are creating. true false
-sitePath The physical path where this Website is located on disk. true false
-bindings An Object Array of bindings. Must include "protocol", "port", and "hostName" true false
-appPoolName The name of the app pool to use true false
-updateIfFound Should we update an existing website if it already exists? false false False

Examples

EXAMPLE 1
New-Site "myWebsite.com" "c:\inetpub\wwwroot" @(@{"protocol" = "http"; "port" = 80; "hostName"="mysite.com"}) "myAppPool" -updateIfFound

Top of page

Syntax

Remove-Application [[-siteName] <Object>] [[-appName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the associated IIS website false false
-appName Name of the IIS application being removed. false false

Examples

EXAMPLE 1
Remove-Application 'mySite' 'myApp'

Top of page

Syntax

Remove-AppPool [[-appPoolName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. false false

Examples

EXAMPLE 1
Remove-AppPool "myAppPool"

Top of page

Syntax

Remove-OracleDatabase [-schemaName] <String> [-schemaOwnerUserId] <String> [-connectionString] <String> [[-failOnError] <Boolean>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-schemaName true false
-schemaOwnerUserId true false
-connectionString true false
-failOnError false false True

Note

WARNING: only to be used on development databases - DROPS the Database!

Examples

EXAMPLE 1
Remove-OracleDatabase 'MyDatabase' 'MyUser' 'Data Source=localhost/XE;User Id=system;Password=SAus3r' $false

Top of page

Syntax

Remove-Site [-siteName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the website as it appears in IIS true false

Examples

EXAMPLE 1
Remove-Site "myWebsite.com"

Top of page

RequiredWindowsFeatures Aliases

  • RequiredFeatures

Syntax

RequiredWindowsFeatures [[-requiredWindowsFeatures] <String[]>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-requiredWindowsFeatures The collection of windows features required. false false

Examples

EXAMPLE 1
RequiredWindowsFeatures @('IIS-WebServer','IIS-WebServerRole')

Top of page

Syntax

Reset-OracleDatabase [-schemaName] <String> [-databaseStorageFile] <String> [-schemaOwnerUserId] <String> [-schemaOwnerPassword] <String> [-connectionString] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-schemaName true false
-databaseStorageFile true false
-schemaOwnerUserId true false
-schemaOwnerPassword true false
-connectionString true false

Note

WARNING: only to be used on development databases - DROPS the Database!

Examples

EXAMPLE 1
Reset-OracleDatabase 'MyDatabase' 'C:\databases\MyDatabase.dbf' 'MyUser' 'MyUserPassword' 'Data Source=localhost/XE;User Id=system;Password=SAus3r'

Top of page

Syntax

Set-IISAuthentication [-authTypes] <AuthType[]> [-value] <PSObject> [-location] <String> [[-disableOthers]] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-authTypes The name of the Authentication setting that we are changing true false
-value What we want to change the setting to. true false
-location The IIS location of the Application or Website that we want to change the setting on. true false
-disableOthers Disables all other authentication types except for the ones contained in the array. false false False

Examples

EXAMPLE 1
Set-IISAuthentication "windowsAuthentication" true "apps.mysite.com/MyApp"

Top of page

Syntax

Set-IISCustomHeader [-siteName] <String> [-customHeaderName] <String> [-customHeaderValue] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName The name of the site to add custom header to. true false
-customHeaderName The name of the custom header to add. true false
-customHeaderValue The value of the custom header to add. true false

Examples

EXAMPLE 1
Set-IISCustomHeader "xyz.mysite.com" "access-control-allow-origin" "*"

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-PSPath None false false
-filter None false false
-location None false false
-name None true false
-retry None false false
-value None true false

Syntax

Start-Application [[-siteName] <Object>] [[-appName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the associated IIS website false false
-appName Name of the IIS application being started. false false

Examples

EXAMPLE 1
Start-Application 'mySite' 'myApp'

Top of page

Syntax

Start-AppPool [[-appPoolName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. false false

Examples

EXAMPLE 1
Start-AppPool "myAppPool"

Top of page

Syntax

Start-Site [-siteName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the website as it appears in IIS true false

Examples

EXAMPLE 1
Start-Site "myWebsite.com"

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-action None true false
-name None true false

Syntax

Stop-Application [[-siteName] <Object>] [[-appName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the associated IIS website false false
-appName Name of the IIS application being stopped. false false

Examples

EXAMPLE 1
Stop-Application 'mySite' 'myApp'

Top of page

Syntax

Stop-AppPool [[-appPoolName] <Object>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. false false

Examples

EXAMPLE 1
Stop-AppPool "myAppPool"

Top of page

Syntax

Stop-Site [-siteName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the website as it appears in IIS true false

Examples

EXAMPLE 1
Stop-Site "myWebsite.com"

Top of page

Parameters

Name Alias Description Required? Pipeline Input Default Value
-path None true false

Syntax

Test-RunAsAdmin [<CommonParameters>]

Examples

EXAMPLE 1
Test-RunAsAdministrator

Top of page

Syntax

Update-Application [-siteName] <String> [-appName] <String> [-appPath] <String> [-appPoolName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName Name of the associated IIS Website true false
-appName Name of the IIS Application to be updated true false
-appPath Fully qualified path to the application being updated. true false
-appPoolName Name of the application pool that the app is running under. true false

Examples

EXAMPLE 1
Update-Application 'mySite' 'myApp' 'C:\inetput\wwwroot' 'appPoolName'

Top of page

Syntax

Update-AppPool [-appPoolName] <String> [[-appPoolIdentityType] <String>] [[-maxProcesses] <Int32>] [[-username] <String>] [[-password] <String>] [[-idleTimeout] <TimeSpan>] [[-managedPipelineMode] <String>] [[-managedRuntimeVersion] <String>] [-alwaysRunning] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-appPoolName The name of the application pool. true false
-appPoolIdentityType The type of identity you want the AppPool to run as, default is 'LocalSystem'. false false NetworkService
-maxProcesses The number of Worker Processes this AppPool should spawn, default is 1. false false 1
-username The Username that this app pool should run as. false false
-password The password for the Username that this app pool should run as. false false
-idleTimeout Amount of time a worker process will remain idle before it shuts down. false false 00:20:00
-managedPipelineMode Is the app pool to be running as 'Classic', or 'Integrated' (Defaults to Integrated) false false Integrated
-managedRuntimeVersion Runtime version for the app pool. (Defaults to v4.0) false false v4.0
-alwaysRunning Should the app pool be configured as 'Always Running' false false False

Examples

EXAMPLE 1
Update-AppPool "myAppPool" "NetworkService"
EXAMPLE 2
Update-AppPool "myAppPool" "NetworkService" -managedPipelineMode 'Classic'

Top of page

Syntax

Update-AssemblyVersions [-Version] <String> [-BuildNumber] <String> [-AssemblyInformationalVersion] <String> [[-projectRoot] <String>] [[-copyrightFormatString] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-Version A string containing the version of this dll. This would be in the format of {Major}.{Minor}.{Revision} true false
-BuildNumber The build number of the assembly. true false
-AssemblyInformationalVersion A string value indicating some info about the assembly true false
-projectRoot Where to begin recursion when searching for the AssemblyInfo.cs files to be updated. false false ..\
-copyrightFormatString copyright The string you want to use in the copyright field false false

Examples

EXAMPLE 1
Update-AssemblyVersions '3.1.2', '233', '3.1.2 Beta 1' -copyright 'Copyright {0} Acme Corp.'

Top of page

Syntax

Update-JsonConfigValues [-configFile] <String> [-node] <String> [-value] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-configFile Path to JSON config file true false
-node Path to property being updated (dotted notation) true false
-value New value for the updated node. true false

Note

If Powershell version => 3 is available, the final text will retain formatting. If only Powershell version 2 is available, all formatting will be lost, and the output will be a single line.

Examples

EXAMPLE 1
Update-JsonConfigValues "c:\path\to.json" "user[0].address.streetAddress" "21 Jump St."
EXAMPLE 2
Update-JsonConfigValues "c:\path\to.json" "website.siteHost" "http://www.example.com"

Top of page

Syntax

Update-Site [-siteName] <String> [-sitePath] <String> [-bindings] <Object[]> [-appPoolName] <String> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-siteName The name of the Website that we are updating. true false
-sitePath The physical path where this Website is located on disk. true false
-bindings An Object Array of bindings. Must include "protocol", "port", and "hostName" true false
-appPoolName The name of the app pool to use true false

Examples

EXAMPLE 1
Update-Site "myWebsite.com" "c:\inetpub\wwwroot" @(@{"protocol" = "http"; "port" = 80; "hostName"="mysite.com"}) "myAppPool"

Top of page

Syntax

Update-XmlConfigValues [-configFile] <String> [-xpath] <String> [-value] <String> [[-attributeName] <String>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-configFile A path to a file that is XML based true false
-xpath Any valid XPath exression, wether result in 1 or many matches, wether a Element or and Attribute. true false
-value Any valid XML value that you wish to set. true false
-attributeName false false

Examples

EXAMPLE 1
Update-ConfigValues "C:\temp\somefile.config" "//SomeNode/AnotherNode" "Some New Value"

Top of page

Use-Object Aliases

  • psUsing

Syntax

Use-Object [-InputObject] <Object> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-InputObject A disposable object. This object will be disposed of once the script block finishes execution. true false
-ScriptBlock The script block to be executed. true false

Examples

EXAMPLE 1
Use-Object ($foo = new-object System.Some.Disposable.Object) { $foo.DoSomething }
EXAMPLE 2
psUsing($foo = new-object System.Some.Disposable.Object) { $foo.DoSomething }

Top of page

Syntax

Write-TokenReplacedFile [[-fileToTokenReplace] <String>] [[-outFile] <String>] [[-tokenValues] <Hashtable>] [<CommonParameters>]

Parameters

Name Alias Description Required? Pipeline Input Default Value
-fileToTokenReplace File to perform token replacement on false false
-outFile Output file for token replaced result false false
-tokenValues Hashtable of key value pairs to replaced in file false false

Note

The file is token replaced and the contents stored in requested output file

Examples

EXAMPLE 1
Write-TokenReplacedFile "somePath\someFile.txt" "somePath\tokenReplacedFile.txt" @{ 'token1Key' = 'token1Value'; 'token2Key' = 'token2Value' }

Top of page