%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : www.kowitt.ac.th / Your IP : 216.73.216.118 Web Server : Microsoft-IIS/7.5 System : Windows NT SERVER02 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.6.31 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Windows/System32/WindowsPowerShell/v1.0/en-US/ |
Upload File : |
<?xml version="1.0" encoding="utf-8" ?> <helpItems schema="maml"> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Add-History </command:name> <maml:description> <maml:para>Appends entries to the session history.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Add</command:verb> <command:noun>History</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Add-History cmdlet adds entries to the end of the session history, that is, the list of commands entered during the current session. You can use the Get-History cmdlet to get the commands and pass them to Add-History, or you can export the commands to a CSV or XML file, then import the commands, and pass the imported file to Add-History. You can use this cmdlet to add specific commands to the history or to create a single history file that includes commands from more than one session.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Add-History</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Adds the specified HistoryInfo object to the session history. You can use this parameter to submit a HistoryInfo object from Get-History, Import-Clixml, or Import-Csv to Add-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSObject[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns a history object for each history entry. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Adds the specified HistoryInfo object to the session history. You can use this parameter to submit a HistoryInfo object from Get-History, Import-Clixml, or Import-Csv to Add-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSObject[]</command:parameterValue> <dev:type> <maml:name>PSObject[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns a history object for each history entry. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.PowerShell.Commands.HistoryInfo</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a HistoryInfo object to Add-History. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or Microsoft.PowerShell.Commands.HistoryInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> When you use the PassThru parameter, Add-History generates a HistoryInfo object. Otherwise, this cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> The session history is a list of the commands entered during the session along with the ID. The session history represents the order of execution, the status, and the start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it. For more information about the session history, see about_History. To specify the commands to add to the history, use the InputObject parameter. The Add-History command accepts only HistoryInfo objects, such as those generated for each command by Get-History. You cannot pass it a path and file name or a list of commands. You can use the -InputObject parameter to pass a file of HistoryInfo objects to Add-History. To do so, export the results of a Get-History command to a file by using Export-Csv or Export-Clixml and then import the file by using Import-Csv or Import-Clixml. You can then pass the file of imported HistoryInfo objects to Add-History through a pipeline or in a variable. For more information, see the examples. The file of HistoryInfo objects that you pass to Add-History must include the type information, column headings, and all of the properties of the HistoryInfo objects. If you intend to pass the objects back to Add-History, do not use the NoTypeInformation parameter of Export-Csv and do not delete the type information, column headings, or any fields in the file. To edit the session history, export the session to a CSV or XML file, edit the file, import the file, and use Add-History to append it to the current session history. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history | export-csv c:\testing\history.csv C:\PS>import-csv history.csv | add-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands add the commands typed in one Windows PowerShell session to the history of a different Windows PowerShell session. The first command gets objects representing the commands in the history and exports them to the History.csv file. The second command is typed at the command line of a different session. It uses the Import-Csv cmdlet to import the objects in the History.csv file. The pipeline operator passes the objects to the Add-History cmdlet, which adds the objects representing the commands in the History.csv file to the current session history.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-clixml c:\temp\history.xml | add-history -passthru | foreach-object {invoke-history} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command imports commands from the History.xml file, adds them to the current session history, and then executes the commands in the combined history. The first command uses the Import-Clixml command to import a command history that was exported to the History.xml file. The pipeline operator (|) passes the commands to the Add-History parameter, which adds the commands to the current session history. The PassThru parameter passes the objects representing the added commands down the pipeline. The command then uses the ForEach-Object cmdlet to apply the Invoke-History command to each of the commands in the combined history. The Invoke-History command is formatted as a script block, which is enclosed in braces ({}) because ForEach-Object requires a script block even when there is only one command to apply.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history -id 5 -count 5 | add-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command adds the first five commands in the history to the end of the history list. It uses the Get-History cmdlet to get the five commands ending in command 5. The pipeline operator (|) passes them to the Add-History cmdlet, which appends them to the current history. The Add-History command does not include any parameters, but Windows PowerShell associates the objects passed through the pipeline with the InputObject parameter.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $a = import-csv c:\testing\history.csv C:\PS>add-history -inputobject $a -passthru </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands add the commands in the History.csv file to the current session history. The first command uses the Import-Csv cmdlet to import the commands in the History.csv file and store its contents in the variable $a. The second command uses the Add-History cmdlet to add the commands from History.csv to the current session history. It uses the InputObject parameter to specify the $a variable and the PassThru parameter to generate an object to display at the command line. Without the PassThru parameter, Add-History does not generate any output to display.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> add-history -inputobject (import-clixml c:\temp\history01.xml) </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command adds the commands in the History01.xml file to the current session history. It uses the InputObject parameter to pass the results of the command in parentheses to Add-History. The command in parentheses, which is executed first, imports the History01.xml file into Windows PowerShell. Add-History then adds the commands in the file to the session history.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113279</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Clear-History</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Add-PSSnapin </command:name> <maml:description> <maml:para>Adds one or more Windows PowerShell snap-ins to the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Add</command:verb> <command:noun>PSSnapin</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Add-PSSnapin cmdlet adds registered Windows PowerShell snap-ins to the current session. After the snap-ins are added, you can use the cmdlets and providers that the snap-ins support in the current session. To add the snap-in to all future Windows PowerShell sessions, add an Add-PSSnapin command to your Windows PowerShell profile. For more information, see about_Profiles.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Add-PSSnapin</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the snap-in. (This is the Name, not the AssemblyName or ModuleName.) To find the names of the registered snap-ins on your system, type: "get-pssnapin -registered".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing each added snap-in. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the snap-in. (This is the Name, not the AssemblyName or ModuleName.) To find the names of the registered snap-ins on your system, type: "get-pssnapin -registered".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing each added snap-in. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe objects to Add-PSSnapin. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or System.Management.Automation.PSSnapInInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> When you use the PassThru parameter, Add-PSSnapin returns a PSSnapInInfo object that represents the snap-in. Otherwise, this cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> For detailed information about snap-ins in Windows PowerShell, see about_PSSnapins. For information about how to create a Windows PowerShell snap-in, see "How to Create a Windows PowerShell Snap-in" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=144762. Add-PSSnapin adds the snap-in only to the current session. To add the snap-in to all Windows PowerShell sessions, add it to your Windows PowerShell profile. For more information, see about_Profiles. You can add any Windows PowerShell snap-in that has been registered by using the Microsoft .NET Framework install utility. For more information, see "How to Register Cmdlets, Providers, and Host Applications" in the MSDN library at http://go.microsoft.com/fwlink/?LinkID=143619. To get a list of snap-ins that are registered on your computer, type "get-pssnapin -registered". Before adding a snap-in, Add-PSSnapin checks the version of the snap-in to verify that it is compatible with the current version of Windows PowerShell. If the snap-in fails the version check, Windows PowerShell reports an error. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> add-PSSnapIn Microsoft.Exchange, Microsoft.Windows.AD </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command adds the Microsoft Exchange and Active Directory snap-ins to the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssnapin -registered | add-pssnapin -passthru </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command adds all of the registered Windows PowerShell snap-ins to the session. It uses the Get-PSSnapin cmdlet with the Registered parameter to get objects representing each of the registered snap-ins. The pipeline operator (|) passes the result to Add-PSSnapin, which adds them to the session. The PassThru parameter returns objects that represent each of the added snap-ins.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssnapin </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example demonstrates the process of registering a snap-in on your system and then adding it to your session. It uses ManagementFeatures, a fictitious snap-in implemented in a file called ManagementCmdlets.dll. The first command gets snap-ins that have been added to the current session, including the snap-ins that are installed with Windows PowerShell. In this example, ManagementFeatures is not returned. This indicates that it has not been added to the session. get-pssnapin The second command gets snap-ins that have been registered on your system (including those that have already been added to the session). It does not include the snap-ins that are installed with Windows PowerShell. get-pssnapin -registered In this case, the command does not return any snap-ins. This indicates that the ManagementFeatures snapin has not been registered on the system. The third command creates an alias, "installutil", for the path to the InstallUtil tool in the .NET Framework. set-alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil.exe The fourth command uses the InstallUtil tool to register the snap-in. The command specifies the path to ManagementCmdlets.dll, the file name or "module name" of the snap-in. installutil C:\Dev\Management\ManagementCmdlets.dll The fifth command is the same as the second command. This time, you use it to verify that the ManagementCmdlets snap-in is registered. get-pssnapin -registered The sixth command uses the Add-PSSnapin cmdlet to add the ManagementFeatures snap-in to the session. It specifies the name of the snap-in, ManagementFeatures, not the file name. add-pssnapin ManagementFeatures To verify that the snap-in is added to the session, the seventh command uses the Module parameter of the Get-Command cmdlet. It displays the items that were added to the session by a snap-in or module. get-command -module ManagementFeatures You can also use the PSSnapin property of the object that Get-Command returns to find the snap-in or module in which a cmdlet originated. The eighth command uses dot notation to find the value of the PSSnapin property of the Set-Alias command. (get-command set-alias).pssnapin </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113281</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Profiles</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Clear-History </command:name> <maml:description> <maml:para>Deletes entries from the command history.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Clear</command:verb> <command:noun>History</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Clear-History cmdlet deletes commands from the command history, that is, the list of commands entered during the current session. Without parameters, Clear-History deletes all commands from the session history, but you can use the parameters of Clear-History to delete selected commands.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Clear-History</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Deletes commands with the specified history IDs. To find the history ID of a command, use Get-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>Count</maml:name> <maml:description> <maml:para>Clears the specified number of history entries, beginning with the oldest entry in the history. If you use the Count and Id parameters in the same command, the cmdlet clears the number of entries specified by the Count parameter, beginning with the entry specified by the Id parameter. For example, if Count is 10 and Id is 30, Clear-History clears items 21 through 30 inclusive. If you use the Count and CommandLine parameters in the same command, Clear-History clears the number of entries specified by the Count parameter, beginning with the entry specified by the CommandLine parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Newest</maml:name> <maml:description> <maml:para>Deletes the newest entries in the history. By default, Clear-History deletes the oldest entries in the history.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Clear-History</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>Count</maml:name> <maml:description> <maml:para>Clears the specified number of history entries, beginning with the oldest entry in the history. If you use the Count and Id parameters in the same command, the cmdlet clears the number of entries specified by the Count parameter, beginning with the entry specified by the Id parameter. For example, if Count is 10 and Id is 30, Clear-History clears items 21 through 30 inclusive. If you use the Count and CommandLine parameters in the same command, Clear-History clears the number of entries specified by the Count parameter, beginning with the entry specified by the CommandLine parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>CommandLine</maml:name> <maml:description> <maml:para>Deletes commands with the specified text strings. If you enter more than one string, Clear-History deletes commands with any of the strings.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Newest</maml:name> <maml:description> <maml:para>Deletes the newest entries in the history. By default, Clear-History deletes the oldest entries in the history.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>CommandLine</maml:name> <maml:description> <maml:para>Deletes commands with the specified text strings. If you enter more than one string, Clear-History deletes commands with any of the strings.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>Count</maml:name> <maml:description> <maml:para>Clears the specified number of history entries, beginning with the oldest entry in the history. If you use the Count and Id parameters in the same command, the cmdlet clears the number of entries specified by the Count parameter, beginning with the entry specified by the Id parameter. For example, if Count is 10 and Id is 30, Clear-History clears items 21 through 30 inclusive. If you use the Count and CommandLine parameters in the same command, Clear-History clears the number of entries specified by the Count parameter, beginning with the entry specified by the CommandLine parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Deletes commands with the specified history IDs. To find the history ID of a command, use Get-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Newest</maml:name> <maml:description> <maml:para>Deletes the newest entries in the history. By default, Clear-History deletes the oldest entries in the history.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe objects to Clear-History. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> The session history is a list of the commands entered during the session. You can view the history, add and delete commands, and run commands from the history. For more information, see about_History. Deleting a command from the history does not change the history IDs of the remaining items in the command history. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> clear-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Deletes all commands from the session history.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> clear-history -id 23, 25 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Deletes the commands with history IDs 23 and 25.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> clear-history -command *help*, *command </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Deletes commands that include "help" or end in "command".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> clear-history -count 10 -newest </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Deletes the 10 newest commands from the history.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> clear-history -id 10 -count 3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Deletes the three oldest commands, beginning with the entry with ID 10.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135199</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-History</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Disable-PSRemoting </command:name> <maml:description> <maml:para>Prevents the computer from receiving remote Windows PowerShell commands.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Disable</command:verb> <command:noun>PSRemoting</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Disable-PSRemoting function disables all session configurations on the local computer by adding a "deny all" entry to their security descriptors. This prevents the local computer from receiving remote commands. Disable-PSRemoting does not stop the WinRM service and it does not prevent users of the local computer from establishing sessions that connect to remote computers or sending commands to other computers. To re-enable the session configurations, use the Enable-PSRemoting or Enable-PSSessionConfiguration cmdlets. To run this function on Windows Vista, Windows Server 2008, and later versions of Windows, you must open Windows PowerShell with the "Run as administrator" option.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Disable-PSRemoting</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any object. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> A session configuration is a group of settings that define the environment for a session. The session configurations are located on the remote computer and are used by local and remote sessions that connect to the computer. Every session that connects to the computer must use one of the session configurations that are registered on the computer. This includes persistent sessions that you create by using New-PSSession or Enter-PSSession cmdlets, and the temporary sessions that Windows PowerShell creates when you use the ComputerName parameter of a cmdlet that uses WS-Management remoting technology, such as Invoke-Command. By denying access to all session configurations, you effectively prevent all users from establishing sessions that connect to the computer. Disable-PSRemoting is the equivalent of "Disable-PSSessionConfiguration -name *. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-psremoting </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables all session configurations on the computer. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-psremoting -force </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables all session configurations on the computer without prompting.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-psremoting -force C:\PS> new-pssession -computername localhost [localhost] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troub leshooting Help topic. + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionOpenFailed C:\PS> new-pssession -computername Server01 Id Name ComputerName State Configuration Availability -- ---- ------------ ----- ------------- ------------ 1 Session1 Server01... Opened Microsoft.PowerShell Available C:\PS> enable-pssessionConfiguration -name * -force C:\PS> new-pssession -computername localhost Id Name ComputerName State Configuration Availability -- ---- ------------ ----- ------------- ------------ 1 Session1 localhost Opened Microsoft.PowerShell Available </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows the effect of using Disable-PSRemoting. The first command uses Disable-PSRemoting to disable all registered session configurations on the local computer. The second command uses the New-PSSession to create a remote session to the local computer (also known as a "loopback"). Because the session configurations that session requires are disabled, the command fails. The third command uses the New-PSSession cmdlet to create a session from the local computer to the Server01 remote computer. This command, which uses the session configurations on the remote computer, succeeds. The fourth command uses the Enable-PSSessionConfiguration cmdlet to re-enable all of the session configurations on the local computer. The command uses a value of * (all) in the Name parameter. The fifth command attempts again to establish a loopback session by using the New-PSSession cmdlet. This time the command succeeds, because the session configuration that requires are enabled.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-psremoting -force C:\PS> get-psSessionConfiguration | format-table -property name, permission -auto Name Permission ---- ---------- microsoft.powershell Everyone AccessDenied, BUILTIN\Administrators AccessAllowed microsoft.powershell32 Everyone AccessDenied, BUILTIN\Administrators AccessAllowed C:\PS> enable-psremoting -force WinRM already is set up to receive requests on this machine. WinRM already is set up for remote management on this machine. C:\PS>> Get-PSSessionConfiguration | ft name, Permission -auto Name Permission ---- ---------- microsoft.powershell BUILTIN\Administrators AccessAllowed microsoft.powershell32 BUILTIN\Administrators AccessAllowed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows the effect on the session configurations of using Disable-PSRemoting and Enable-PSRemoting. The first command uses the Disable-PSRemoting function to disable all registered session configurations. The force parameter suppresses all user prompts. The second command uses the Get-PSSessionConfiguration cmdlet to display the registered session configurations on the computer. The command uses a pipeline operator to send the results to a Format-Table command, which displays only the Name and Permission properties of the configurations in a table. The resulting table shows that everyone is denied permission to the configurations. The third command uses the Enable-PSRemoting cmdlet to re-enable all of the session configurations on the computer. You can also use an "Enable-PsSessionConfiguration -name *" command. The command uses the Force parameter to suppress all user prompts and to restart the WinRM service without prompting. The fourth command uses Get-PSSessionConfiguration and Format-Table to display the names and permissions of the session configurations. The results show that members of the Administrators group now have access to the session configurations.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144298</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSRemoting</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Disable-PSSessionConfiguration </command:name> <maml:description> <maml:para>Denies access to the session configurations on the local computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Disable</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Disable-PSSessionConfiguration cmdlet prevents all users of the computer from using the session configuration in a session. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. The Disable-PSSessionConfiguration cmdlet adds a "deny all" setting to the security descriptor of one or more registered session configurations. As a result, you can unregister, view, and change the configurations, but you cannot use them in a session. Without parameters, Disable-PSSessionConfiguration disables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions. Unless the user specifies a different configuration, both local and remote users are effectively prevented from creating any sessions that connect to the computer. To disable all session configurations on the computer, use Disable-PSRemoting.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Disable-PSSessionConfiguration</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to disable. Enter one or more configuration names. Wildcards are permitted. You can also pipe a string that contains a configuration name or a session configuration object to Disable-PSSessionConfiguration. If you omit this parameter, Disable-PSSessionConfiguration disables the Microsoft.PowerShell session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to disable. Enter one or more configuration names. Wildcards are permitted. You can also pipe a string that contains a configuration name or a session configuration object to Disable-PSSessionConfiguration. If you omit this parameter, Disable-PSSessionConfiguration disables the Microsoft.PowerShell session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Microsoft.PowerShell</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration, System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a session configuration object or a string that contains the name of a session configuration to Disable-PSSessionConfiguration. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any objects. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Disable-PSSessionConfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables the Microsoft.PowerShell session configuration.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-pssessionConfiguration -name * </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables all registered session configurations on the computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> disable-pssessionConfiguration -name Microsoft* -force </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables all session configurations that have names that begin with "Microsoft". The command uses the Force parameter to suppress all user prompts from the command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Get-PSSessionConfiguration -name MaintenanceShell, AdminShell | Disable-PSSessionConfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command disables the MaintenanceShell and AdminShell session configurations. The command uses a pipeline operator (|) to send the results of a Get-PSSessionConfiguration command to Disable-PSSessionConfiguration.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Get-PSSessionConfiguration | format-table -property Name, Permission -auto Name Permission ---- ---------- MaintenanceShell BUILTIN\Administrators AccessAllowed microsoft.powershell BUILTIN\Administrators AccessAllowed microsoft.powershell32 BUILTIN\Administrators AccessAllowed C:\PS> Disable-PSSessionConfiguration -name MaintenanceShell -force C:\PS> Get-PSSessionConfiguration | format-table -property Name, Permission -auto Name Permission ---- ---------- MaintenanceShell Everyone AccessDenied, BUILTIN\Administrators AccessAllowed microsoft.powershell BUILTIN\Administrators AccessAllowed microsoft.powershell32 BUILTIN\Administrators AccessAllowed C:\PS> Set-PSSessionConfiguration -name MaintenanceShell -MaximumReceivedDataSizePerCommandMB 60 ParamName ParamValue --------- ---------- psmaximumreceived... 60 "Restart WinRM service" WinRM service need to be restarted to make the changes effective. Do you want to run the command "restart-service winrm"? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y C:\PS> new-pssession -computername localhost -configurationName MaintenanceShell [localhost] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubl eshooting Help topic. + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionOpenFailed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows the effect of disabling a session configuration. The first command uses the Get-SessionConfiguration and Format-Table cmdlets to display only the Name and Permission properties of the session configuration objects. This table format makes it easier to see the values of the objects. The results show that members of the Administrators group are permitted to use the session configurations. The second command uses the Disable-PSSessionConfiguration cmdlet to disable the MaintenanceShell session configuration. The command uses the Force parameter to suppress all user prompts. The third command repeats the first command. The results show that you can still get the object that represents the MaintenanceShell session configuration even though everyone is denied access to it. The "AccessDenied" entry takes precedence over all other entries in the security descriptor. The fourth command uses the Set-PSSessionConfiguration cmdlet to increase the MaximumDataSizePerCommandMB setting on the MaintenanceShell session configuration to 60. The results show that the command was successful even though everyone is denied access to the configuration. The fifth command attempts to use the MaintenanceShell session configuration in a session. It uses the New-PSSession cmdlet to create a new session and the ConfigurationName parameter to specify the MaintenanceShell configuration. The results show that the New-PSSession command fails because the user is denied access to the configuration. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144299</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Enable-PSRemoting </command:name> <maml:description> <maml:para>Configures the computer to receive remote commands.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Enable</command:verb> <command:noun>PSRemoting</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands that are sent by using the WS-Management technology. You need to run this command only once on each computer that will receive commands. You do not need to run it on computers that only send commands. Because the configuration activates listeners, it is prudent to run it only where it is needed. The Enable-PSRemoting cmdlet performs the following operations: -- Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks: ----- Starts the WinRM service. ----- Sets the startup type on the WinRM service to Automatic. ----- Creates a listener to accept requests on any IP address. ----- Enables a firewall exception for WS-Management communications. -- Enables all registered Windows PowerShell session configurations to receive instructions from a remote computer. ----- Registers the "Microsoft.PowerShell" session configuration, if it is not already registered. ----- Registers the "Microsoft.PowerShell32" session configuration on 64-bit computers, if it is not already registered. ----- Removes the "Deny Everyone" setting from the security descriptor for all the registered session configurations. ----- Restarts the WinRM service to make the preceding changes effective. To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Enable-PSRemoting</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts. By default, you are prompted to confirm each operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.String</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Enable-PSRemoting returns strings that describe its results. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enable-psremoting </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command configures the computer to receive remote commands.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enable-psremoting -force </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command configures the computer to receive remote commands. It uses the Force parameter to suppress the user prompts.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144300</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSRemoting</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Enable-PSSessionConfiguration </command:name> <maml:description> <maml:para>Enables the session configurations on the local computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Enable</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Enable-PSSessionConfiguration cmdlet re-enables registered session configurations that have been disabled by using the Disable-PSSessionConfiguration cmdlet. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. Without parameters, Enable-PSSessionConfiguration re-enables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions. This cmdlet performs the following operations for each enabled configuration: -- Removes the "deny all" setting from the security descriptor of the configuration or replaces the security descriptor with one that you specify. -- Turns on the listener that accepts requests on any IP address. -- Restarts the WinRM service. The Enable-PSSessionConfiguration cmdlet calls the Set-WSManQuickConfig cmdlet. However, it should not be used to enable remoting on the computer. Instead, use the more comprehensive cmdlet, Enable-PSRemoting.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Enable-PSSessionConfiguration</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to enable. Enter one or more configuration names. Wildcards are permitted. You can also pipe a string that contains a configuration name or a session configuration object to Enable-PSSessionConfiguration. If you omit this parameter, Enable-PSSessionConfiguration enables the Microsoft.PowerShell session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Replaces the security descriptor on the session configuration with the specified security descriptor. If you omit this parameter, Enable-PSSessionConfiguration just deletes the "deny all" item from the security descriptor.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to enable. Enter one or more configuration names. Wildcards are permitted. You can also pipe a string that contains a configuration name or a session configuration object to Enable-PSSessionConfiguration. If you omit this parameter, Enable-PSSessionConfiguration enables the Microsoft.PowerShell session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Replaces the security descriptor on the session configuration with the specified security descriptor. If you omit this parameter, Enable-PSSessionConfiguration just deletes the "deny all" item from the security descriptor.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration, System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a session configuration object or a string that contains the name of a session configuration to Enable-PSSessionConfiguration. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any objects. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enable-PSSessionConfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command re-enables the Microsoft.PowerShell default session configuration on the computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enable-PSSessionConfiguration -name MaintenanceShell, AdminShell </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command re-enables the MaintenanceShell and AdminShell session configurations on the computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enable-PSSessionConfiguration -name * C:\PS> Get-PSSessionConfiguration | Enable-PSSessionConfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands re-enable all session configurations on the computer. The commands are equivalent, so you can use either one. Enable-PSSessionConfiguration does not generate an error if you enable a session configuration that is already enabled.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enable-PSSessionConfiguration -name MaintenanceShell -securityDescriptorSDDL "O:NSG:BAD:P(A;;GXGWGR;;;BA)(A;;GAGR;;;S-1-5-21-123456789-188441444-3100496)S:P" </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command re-enables the MaintenanceShell session configuration and specifies a new security descriptor for the configuration.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144301</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Enter-PSSession </command:name> <maml:description> <maml:para>Starts an interactive session with a remote computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Enter</command:verb> <command:noun>PSSession</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Enter-PSSession cmdlet starts an interactive session with a single remote computer. During the session, the commands that you type run on the remote computer, just as though you were typing directly on the remote computer. You can have only one interactive session at a time. Typically, you use the ComputerName parameter to specify the name of the remote computer. However, you can also use a session that you create by using New-PSSession for the interactive session. To end the interactive session and disconnect from the remote computer, use the Exit-PSSession cmdlet, or type "exit". </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Starts an interactive session with the specified remote computer. Enter only one computer name. The default is the local computer. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. You can also pipe a computer name to Enter-PSSession. To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: In Windows Vista and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. Use the following commands to configure the listener: 1. winrm delete winrm/config/listener?Address=*+Transport=HTTP 2. winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="<port-number>"} Do not use the Port parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the ID of an existing session. Enter-PSSession uses the specified session for the interactive session. To find the ID of a session, use the Get-PSSession cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Specifies the instance ID of an existing session. Enter-PSSession uses the specified session for the interactive session. The instance ID is a GUID. To find the instance ID of a session, use the Get-PSSession cmdlet. You can also use the Session, Name, or ID parameters to specify an existing session. Or, you can use the ComputerName parameter to start a temporary session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the friendly name of an existing session. Enter-PSSession uses the specified session for the interactive session. If the name that you specify matches more than one session, the command fails. You can also use the Session, InstanceID, or ID parameters to specify an existing session. Or, you can use the ComputerName parameter to start a temporary session. To establish a friendly name for a session, use the Name parameter of the New-PSSession cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="false" variableLength="false" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Specifies a Windows PowerShell session (PSSession) to use for the interactive session. This parameter takes a session object. You can also use the Name, InstanceID, or ID parameters to specify a PSSession. Enter a variable that contains a session object or a command that creates or gets a session object, such as a New-PSSession or Get-PSSession command. You can also pipe a session object to Enter-PSSession. You can submit only one PSSession with this parameter. If you enter a variable that contains more than one PSSession, the command fails. When you use Exit-PSSession or the EXIT keyword, the interactive session ends, but the PSSession that you created remains open and available for use.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSession</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enter-PSSession</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint for the interactive session. The URI must be fully qualified. The format of this string is as follows: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is as follows: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use this parameter to allow it to redirect the connection. Allows redirection of this connection to an alternate URI. When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter, and see New-PSSessionOption. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use this parameter to allow it to redirect the connection. Allows redirection of this connection to an alternate URI. When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter, and see New-PSSessionOption. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>WSMAN</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AuthenticationMechanism</command:parameterValue> <dev:type> <maml:name>AuthenticationMechanism</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Starts an interactive session with the specified remote computer. Enter only one computer name. The default is the local computer. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. You can also pipe a computer name to Enter-PSSession. To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: In Windows Vista and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint for the interactive session. The URI must be fully qualified. The format of this string is as follows: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is as follows: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Uri</command:parameterValue> <dev:type> <maml:name>Uri</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Current user</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the ID of an existing session. Enter-PSSession uses the specified session for the interactive session. To find the ID of a session, use the Get-PSSession cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Specifies the instance ID of an existing session. Enter-PSSession uses the specified session for the interactive session. The instance ID is a GUID. To find the instance ID of a session, use the Get-PSSession cmdlet. You can also use the Session, Name, or ID parameters to specify an existing session. Or, you can use the ComputerName parameter to start a temporary session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the friendly name of an existing session. Enter-PSSession uses the specified session for the interactive session. If the name that you specify matches more than one session, the command fails. You can also use the Session, InstanceID, or ID parameters to specify an existing session. Or, you can use the ComputerName parameter to start a temporary session. To establish a friendly name for a session, use the Name parameter of the New-PSSession cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. Use the following commands to configure the listener: 1. winrm delete winrm/config/listener?Address=*+Transport=HTTP 2. winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="<port-number>"} Do not use the Port parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Specifies a Windows PowerShell session (PSSession) to use for the interactive session. This parameter takes a session object. You can also use the Name, InstanceID, or ID parameters to specify a PSSession. Enter a variable that contains a session object or a command that creates or gets a session object, such as a New-PSSession or Get-PSSession command. You can also pipe a session object to Enter-PSSession. You can submit only one PSSession with this parameter. If you enter a variable that contains more than one PSSession, the command fails. When you use Exit-PSSession or the EXIT keyword, the interactive session ends, but the PSSession that you created remains open and available for use.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSession</command:parameterValue> <dev:type> <maml:name>PSSession</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> <dev:type> <maml:name>PSSessionOption</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String or System.Management.Automation.Runspaces.PSSession</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a computer name (a string) or a session object to Enter-PSSession. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> The cmdlet does not return any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> -- To connect to a remote computer, you must be a member of the Administrators group on the remote computer. -- In Windows Vista and later versions of Windows, to start an interactive session on the local computer, you must start Windows PowerShell with the "Run as administrator" option. -- When you use Enter-PSSession, your user profile on the remote computer is used for the interactive session. The commands in the remote user profile, including commands to add Windows PowerShell snap-ins and to change the command prompt, run before the remote prompt is displayed. -- Enter-PSSession uses the UI culture setting on the local computer for the interactive session. To find the local UI culture, use the $UICulture automatic variable. -- Enter-PSSession requires the Get-Command, Out-Default, and Exit-PSSession cmdlets. If these cmdlets are not included in the session configuration on the remote computer, the Enter-PSSession commands fails. -- Unlike Invoke-Command, which parses and interprets the commands before sending them to the remote computer, Enter-PSSession sends the commands directly to the remote computer without interpretation. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enter-PSSession LocalHost\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command starts an interactive session on the local computer. The command prompt changes to indicate that you are now running commands in a different session. The commands that you enter run in the new session, and the results are returned to the default session as text.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enter-pssession -computer Server01 Server01\PS> get-process powershell > C:\ps-test\process.txt Server01\PS> exit-pssession C:\PS> C:\PS> dir C:\ps-test\process.txt Get-ChildItem : Cannot find path 'C:\ps-test\process.txt' because it does not exist. At line:1 char:4 + dir <<<< c:\ps-test\process.txt </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command shows how to work in an interactive session with a remote computer. The first command uses the Enter-PSSession cmdlet to start an interactive session with Server01, a remote computer. When the session starts, the command prompt changes to include the computer name. The second command gets the PowerShell process and redirects the output to the Process.txt file. The command is submitted to the remote computer, and the file is saved on the remote computer. The third command uses the Exit keyword to end the interactive session and close the connection. The fourth command confirms that the Process.txt file is on the remote computer. A Get-ChildItem ("dir") command on the local computer cannot find the file.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01 C:\PS> Enter-PSSession -session $s Server01\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands use the Session parameter of Enter-PSSession to run the interactive session in an existing Windows PowerShell session (PSSession). </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enter-PSSession -computername Server01 -port 90 -credential domain01\user01 Server01\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command starts an interactive session with the Server01 computer. It uses the Port parameter to specify the port and the Credential parameter to specify the account of a user with permission to connect to the remote computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enter-PSSession -computername Server01 Server01:\PS> Exit-PSSession C:\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to start and stop an interactive session. The first command uses the Enter-PSSession cmdlet to start an interactive session with the Server01 computer. The second command uses the Exit-PSSession cmdlet to end the session. You can also use the Exit keyword to end the interactive session. Exit-PSSession and Exit have the same effect.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135210</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exit-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Exit-PSSession </command:name> <maml:description> <maml:para>Ends an interactive session with a remote computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Exit</command:verb> <command:noun>PSSession</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Exit-PSSession cmdlet ends interactive sessions that you started by using Enter-PSSession. You can also use the Exit keyword to end an interactive session. The effect is the same as using Exit-PSSession.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Exit-PSSession</maml:name> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe objects to Exit-PSSession. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> This cmdlet takes only the common parameters. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enter-PSSession -computername Server01 Server01\PS> Exit-PSSession C:\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands start and then stop an interactive session with the Server01 remote computer. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01 C:\PS> Enter-PSSession -session $s Server01\PS> Exit-PSSession C:\PS> $s Id Name ComputerName State ConfigurationName -- ---- ------------ ----- ----------------- 1 Session1 Server01 Opened Microsoft.PowerShell </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands start and stop an interactive session with the Server01 computer that uses a Windows PowerShell session (PSSession). Because the interactive session was started by using a Windows PowerShell session (PSSession), the PSSession is still available when the interactive session ends. If you use the ComputerName parameter, Enter-PSSession creates a temporary session that it closes when the interactive session ends. The first command uses the New-PSSession cmdlet to create a PSSession on the Server01 computer. The command saves the PSSession in the $s variable. The second command uses the Enter-PSSession cmdlet to start an interactive session using the PSSession in $s. The third command uses the Exit-PSSession cmdlet to stop the interactive session. The final command displays the PSSession in the $s variable. The State property shows the PSSession is still open and available for use.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Enter-PSSession -computername Server01 Server01\PS> exit C:\PS> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Exit keyword to stop an interactive session started by using the Enter-PSSession cmdlet. The Exit keyword has the same effect as using Exit-PSSession.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135212</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Export-Console </command:name> <maml:description> <maml:para>Exports the names of snap-ins in the current session to a console file.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Export</command:verb> <command:noun>Console</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Export-Console cmdlet exports the names of the Windows PowerShell snap-ins in the current session to a Windows PowerShell console file (.psc1). You can use this cmdlet to save the snap-ins for use in future sessions. To add the snap-ins in the .psc1 console file to a session, start Windows PowerShell (Powershell.exe) at the command line by using Cmd.exe or another Windows PowerShell session, and then use the PSConsoleFile parameter of Powershell.exe to specify the console file. For more information about Windows PowerShell snap-ins, see about_PSSnapins. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Export-Console</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies a path and file name for the console file (*.psc1). Enter a path (optional) and name. Wildcards are not permitted. If you type only a file name, Export-Console creates a file with that name and the ".psc1" file name extension in the current directory. This parameter is required unless you have opened Windows PowerShell with the PSConsoleFile parameter or exported a console file during the current session. It is also required when you use the NoClobber parameter to prevent the current console file from being overwritten. If you omit this parameter, Export-Console overwrites (replaces the content of) the console file that was used most recently in this session. The path to the most recently used console file is stored in the value of the $ConsoleFileName automatic variable. For more information, see about_Automatic_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Overwrites the data in a console file without warning, even if the file has the read-only attribute. The read-only attribute is changed and is not reset when the command completes.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoClobber</maml:name> <maml:description> <maml:para>Will not overwrite (replace the contents of) an existing console file. By default, if a file exists in the specified path, Export-Console overwrites the file without warning.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Overwrites the data in a console file without warning, even if the file has the read-only attribute. The read-only attribute is changed and is not reset when the command completes.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoClobber</maml:name> <maml:description> <maml:para>Will not overwrite (replace the contents of) an existing console file. By default, if a file exists in the specified path, Export-Console overwrites the file without warning.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies a path and file name for the console file (*.psc1). Enter a path (optional) and name. Wildcards are not permitted. If you type only a file name, Export-Console creates a file with that name and the ".psc1" file name extension in the current directory. This parameter is required unless you have opened Windows PowerShell with the PSConsoleFile parameter or exported a console file during the current session. It is also required when you use the NoClobber parameter to prevent the current console file from being overwritten. If you omit this parameter, Export-Console overwrites (replaces the content of) the console file that was used most recently in this session. The path to the most recently used console file is stored in the value of the $ConsoleFileName automatic variable. For more information, see about_Automatic_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a path string to Export-Console. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.IO.FileInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Export-Console creates a file that contains the exported aliases. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> When a console file (.psc1) is used to start the session, the name of the console file is automatically stored in the $ConsoleFileName automatic variable. The value of $ConsoleFileName is updated when you use the Path parameter of Export-Console to specify a new console file. When no console file is used, $ConsoleFileName has no value ($null). To use a Windows PowerShell console file in a new session, use the following syntax to start Windows PowerShell: "powershell.exe -PsConsoleFile <ConsoleFile>.psc1". You can also save Windows PowerShell snap-ins for future sessions by adding an Add-PSSnapin command to your Windows PowerShell profile. For more information, see about_Profiles. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> export-console -path $pshome\Consoles\ConsoleS1.psc1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports the names of Windows PowerShell snap-ins in the current session to the ConsoleS1.psc1 file in the Consoles subdirectory of the Windows PowerShell installation directory, $pshome. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> export-console </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports the names of Windows PowerShell snap-ins from current session to the Windows PowerShell console file that was most recently used in the current session. It overwrites the previous file contents. If you have not exported a console file during the current session, you are prompted for permission to continue and then prompted for a file name.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> add-pssnapin NewPSSnapin C:\PS> export-console -path NewPSSnapinConsole.psc1 C:\PS> powershell.exe -PsConsoleFile NewPsSnapinConsole.psc1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands add the NewPSSnapin Windows PowerShell snap-in to the current session, export the names of Windows PowerShell snap-ins in the current session to a console file, and then start a Windows PowerShell session with the console file. The first command uses the Add-PSSnapin cmdlet to add the NewPSSnapin snap-in to the current session. You can only add Windows PowerShell snap-ins that are registered on your system. The second command exports the Windows PowerShell snap-in names to the NewPSSnapinConsole.psc1 file. The third command starts Windows PowerShell with the NewPSSnapinConsole.psc1 file. Because the console file includes the Windows PowerShell snap-in name, the cmdlets and providers in the snap-in are available in the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> export-console -path Console01 C:\PS> notepad console01.psc1 <?xml version="1.0" encoding="utf-8"?> <PSConsoleFile ConsoleSchemaVersion="1.0"> <PSVersion>2.0</PSVersion> <PSSnapIns> <PSSnapIn Name="NewPSSnapin" /> </PSSnapIns> </PSConsoleFile> </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports the names of the Windows PowerShell snap-ins in the current session to the Console01.psc1 file in the current directory. The second command displays the contents of the Console01.psc1 file in Notepad.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> powershell.exe -PSConsoleFile Console01.psc1 C:\PS> add-pssnapin MySnapin C:\PS> export-console NewConsole.psc1 C:\PS> $consolefilename C:\PS> add-pssnapin SnapIn03 C:\PS> export-console </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the $ConsoleFileName automatic variable to determine the console file that will be updated if you use Export-Console without a Path parameter value. The first command uses the PSConsoleFile parameter of PowerShell.exe to open Windows PowerShell with the Console01.psc1 file. The second command uses the Add-PSSnapin cmdlet to add the MySnapin Windows PowerShell snap-in to the current session. The third command uses the Export-Console cmdlet to export the names of all the Windows PowerShell snap-ins in the session to the NewConsole.psc1 file. The fourth command uses the $ConsoleFileName parameter to display the most recently used console file. The sample output shows that NewConsole.ps1 is the most recently used file. The fifth command adds SnapIn03 to the current console. The sixth command uses the ExportConsole cmdlet without a Path parameter. This command exports the names of all the Windows PowerShell snap-ins in the current session to the most recently used file, NewConsole.psc1. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113298</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Export-ModuleMember </command:name> <maml:description> <maml:para>Specifies the module members that are exported.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Export</command:verb> <command:noun>ModuleMember</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Export-ModuleMember cmdlet specifies the module members (such as cmdlets, functions, variables, and aliases) that are exported from a script module (.psm1) file, or from a dynamic module created by using the New-Module cmdlet. This cmdlet can be used only in a script module file or a dynamic module. If a script module does not include an Export-ModuleMember command, the functions in the script module are exported, but the variables and aliases are not. When a script module includes an Export-ModuleMember command, only the members specified in the Export-ModuleMember command are exported. If a script module contains multiple Export-ModuleMember commands, only the members listed in an Export-ModuleMember command are exported. You can also use Export-ModuleMember to export members that the script module imports from other modules.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Export-ModuleMember</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Function</maml:name> <maml:description> <maml:para>Specifies the functions that are exported from the script module file. Enter the function names. Wildcards are permitted. You can also pipe function name strings to Export-ModuleMember.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Specifies the aliases that are exported from the script module file. Enter the alias names. Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Specifies the cmdlets that are exported from the script module file. Enter the cmdlet names. Wildcards are permitted. You cannot create cmdlets in a script module file, but you can import cmdlets from a binary module into a script module and re-export them from the script module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Specifies the variables that are exported from the script module file. Enter the variable names (without a dollar sign). Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Specifies the aliases that are exported from the script module file. Enter the alias names. Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Specifies the cmdlets that are exported from the script module file. Enter the cmdlet names. Wildcards are permitted. You cannot create cmdlets in a script module file, but you can import cmdlets from a binary module into a script module and re-export them from the script module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Function</maml:name> <maml:description> <maml:para>Specifies the functions that are exported from the script module file. Enter the function names. Wildcards are permitted. You can also pipe function name strings to Export-ModuleMember.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Specifies the variables that are exported from the script module file. Enter the variable names (without a dollar sign). Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe function name strings to Export-ModuleMember. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To exclude a member from the list of exported members, add an Export-ModuleMember command that lists all other members but omits the member that you want to exclude. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Export-ModuleMember -function * -alias * </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports the aliases defined in the script module, along with the functions defined in the script module. To export the aliases, which are not exported by default, you must also explicitly specify the functions. Otherwise, only the aliases will be exported. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Export-ModuleMember -function Get-Test, New-Test, Start-Test -alias gtt, ntt, stt </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports three aliases and three functions defined in the script module. You can use this command format to specify the names of module members.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Export-ModuleMember </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command specifies that no members defined in the script module are exported. This command prevents the module members from being exported, but it does not hide the members. Users can read and copy module members or use the call operator (&) to invoke module members that are not exported.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Export-ModuleMember -variable increment </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command exports only the $increment variable from the script module. No other members are exported. If you want to export a variable, in addition to exporting the functions in a module, the Export-ModuleMember command must include the names of all of the functions and the name of the variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> # From TestModule.psm1 function new-test { <function code> } export-modulemember -function new-test function validate-test { <function code> } function start-test { <function code> } set-alias stt start-test export-modulemember -function *-test -alias stt </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands show how multiple Export-ModuleMember commands are interpreted in a script module (.psm1) file. These commands create three functions and one alias, and then they export two of the functions and the alias. Without the Export-ModuleMember commands, all three of the functions would be exported, but the alias would not be exported. With the Export-ModuleMember commands, only the Get-Test and Start-Test functions and the STT alias are exported. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-module -script {function SayHello {"Hello!"}; set-alias Hi SayHello; Export-ModuleMember -alias Hi -function SayHello} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command shows how to use Export-ModuleMember in a dynamic module that is created by using the New-Module cmdlet. In this example, Export-ModuleMember is used to export both the "Hi" alias and the "SayHello" function in the dynamic module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> function export { param ( [parameter(mandatory=$true)] [validateset("function","variable")] $type, [parameter(mandatory=$true)] $name, [parameter(mandatory=$true)] $value ) if ($type -eq "function") { Set-item "function:script:$name" $value Export-ModuleMember $name } else { Set-Variable -scope Script $name $value Export-ModuleMember -variable $name } } export function New-Test { ... } function helper { ... } export variable interval 0 $interval = 2 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example includes a function named Export that declares a function or creates a variable, and then writes an Export-ModuleMember command for the function or variable. This lets you declare and export a function or variable in a single command. To use the Export function, include it in your script module. To export a function, type "Export" before the Function keyword. To export a variable, use the following format to declare the variable and set its value: export variable <variable-name> <value> The commands in the example show the correct format. In this example, only the New-Test function and the $Interval variable are exported.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141551</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> ForEach-Object </command:name> <maml:description> <maml:para>Performs an operation against each of a set of input objects.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>ForEach</command:verb> <command:noun>Object</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The ForEach-Object cmdlet performs an operation on each of a set of input objects. The input objects can be piped to the cmdlet or specified by using the InputObject parameter. The operation to perform is described within a script block that is provided to the cmdlet as the value of the Process parameter. The script block can contain any Windows PowerShell script. Within the script block, the current input object is represented by the $_ variable. In addition to using the script block that describes the operations to be carried out on each input object, you can provide two additional script blocks. One, specified as the value of the Begin parameter, runs before the first input object is processed. The other, specified as the value of the End parameter, runs after the last input object is processed. The results of the evaluation of all the script blocks, including the ones specified with Begin and End, are passed down the pipeline.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>ForEach-Object</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Process</maml:name> <maml:description> <maml:para>Specifies the script block that is applied to each incoming object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">ScriptBlock[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Begin</maml:name> <maml:description> <maml:para>Specifies a script block to run before processing any input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>End</maml:name> <maml:description> <maml:para>Specifies a script block to run after processing all input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Accepts an object that the script block specified in the process parameter will act upon. Enter a variable that contains the objects, or type a command or expression that gets the objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Begin</maml:name> <maml:description> <maml:para>Specifies a script block to run before processing any input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>End</maml:name> <maml:description> <maml:para>Specifies a script block to run after processing all input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Accepts an object that the script block specified in the process parameter will act upon. Enter a variable that contains the objects, or type a command or expression that gets the objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> <dev:type> <maml:name>psobject</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Process</maml:name> <maml:description> <maml:para>Specifies the script block that is applied to each incoming object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">ScriptBlock[]</command:parameterValue> <dev:type> <maml:name>ScriptBlock[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe any object to ForEach-Object. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> The objects that ForEach-Object returns are determined by the input. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> 30000,56798,12432 | foreach-object -process {$_/1024} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command accepts an array of integers, divides each one of them by 1024, and displays the results.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-childitem C:\ | foreach-object -process { $_.length / 1024 } </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command retrieves the files and directories in the root of the C: drive, and it returns and displays the size of each of them. The zeros represent directories in which no file size was available.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $events = get-eventlog -logname system -newest 1000 C:\PS> $events | foreach-object -begin {get-date} -process {out-file -filepath events.txt -append -inputobject $_.message} -end {get-date} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command retrieves the 1000 most recent events from the system log and stores them in the $events variable. It then pipes the events to the ForEach-Object cmdlet. The Begin parameter displays the current date and time. Next, the Process parameter uses the Out-File cmdlet to create a text file named events.txt and stores the message property of each of the events in that file. Last, the End parameter is used to display the date and time after all of the processing has completed.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-itemproperty -path hkcu:\Network\* | foreach-object {set-itemproperty -path $_.pspath -name RemotePath -value $_.RemotePath.ToUpper();} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command changes the value of the RemotePath registry entry in all of the subkeys under the HKCU:\Network key to uppercase text. You can use this format to change the form or content of a registry entry value. Each subkey in the Network key represents a mapped network drive that will reconnect at logon. The RemotePath entry contains the UNC path of the connected drive. For example, if you map the E: drive to \\Server\Share, there will be an E subkey of HKCU:\Network and the value of the RemotePath registry entry in the E subkey will be \\Server\Share. The command uses the Get-ItemProperty cmdlet to get all of the subkeys of the Network key and the Set-ItemProperty cmdlet to change the value of the RemotePath registry entry in each key. In the Set-ItemProperty command, the path is the value of the PSPath property of the registry key. (This is a property of the Microsoft .NET Framework object that represents the registry key; it is not a registry entry.) The command uses the ToUpper() method of the RemotePath value, which is a string (REG_SZ). Because Set-ItemProperty is changing the property of each key, the ForEach-Object cmdlet is required to access the property.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113300</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-Command </command:name> <maml:description> <maml:para>Gets basic information about cmdlets and other elements of Windows PowerShell commands.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>Command</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-Command cmdlet gets basic information about cmdlets and other elements of Windows PowerShell commands in the session, such as aliases, functions, filters, scripts, and applications. Get-Command gets its data directly from the code of a cmdlet, function, script, or alias, unlike Get-Help, which gets its information from help topic files. Without parameters, "Get-Command" gets all of the cmdlets and functions in the current session. "Get-Command *" gets all Windows PowerShell elements and all of the non-Windows-PowerShell files in the Path environment variable ($env:path). It groups the files in the "Application" command type. You can use the Module parameter of Get-Command to find the commands that were added to the session by adding a Windows PowerShell snap-in or importing a module. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-Command</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets information only about the cmdlets or command elements with the specified name. <String> represents all or part of the name of the cmdlet or command element. Wildcards are permitted. To list commands with the same name in execution order, type the command name without wildcard characters. For more information, see the Notes section.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>CommandType</maml:name> <maml:description> <maml:para>Gets only the specified types of commands. Use "CommandType" or its alias, "Type". By default, Get-Command gets cmdlets and functions. Valid values are: -- Alias: All Windows PowerShell aliases in the current session. -- All: All command types. It is the equivalent of "get-command *". -- Application: All non-Windows-PowerShell files in paths listed in the Path environment variable ($env:path), including .txt, .exe, and .dll files. -- Cmdlet: The cmdlets in the current session. "Cmdlet" is the default. -- ExternalScript: All .ps1 files in the paths listed in the Path environment variable ($env:path). -- Filter and Function: All Windows PowerShell functions. -- Script: Script blocks in the current session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Alias</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Function</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Filter</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Cmdlet</command:parameterValue> <command:parameterValue required="false" variableLength="false" >ExternalScript</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Application</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Script</command:parameterValue> <command:parameterValue required="false" variableLength="false" >All</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="2"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Gets information about a cmdlet or function when it is used with the specified parameters ("arguments"), such as a path. The alias for ArgumentList is Args. To detect parameters that are added to a cmdlet when it is used with a particular provider, set the value of ArgumentList to a path in the provider drive, such as "HKML\Software" or "cert:\my".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Module</maml:name> <maml:description> <maml:para>Gets the commands that came from the specified modules or snap-ins. Enter the names of modules or snap-ins, or enter snap-in or module objects. You can refer to this parameter by its name, Module, or by its alias, PSSnapin. The parameter name that you choose has no effect on the command or its output. This parameter takes string values, but you can also supply a PSModuleInfo or PSSnapinInfo object, such as the objects that Get-Module, Get-PSSnapin, and Import-PSSession return. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Syntax</maml:name> <maml:description> <maml:para>Gets only specified data about the command element. * For aliases, retrieves the standard name. * For cmdlets, retrieves the syntax. * For functions and filters, retrieves the function definition. * For scripts and applications (files), retrieves the path and filename.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>TotalCount</maml:name> <maml:description> <maml:para>Gets only the specified number of command elements. You can use this parameter to limit the output of a command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Command</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Noun</maml:name> <maml:description> <maml:para>Gets cmdlets and functions with names that include the specified noun. <String> represents one or more nouns or noun patterns, such as "process" or "*item*". Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Verb</maml:name> <maml:description> <maml:para>Gets information about cmdlets and functions with names that include the specified verb. <String> represents one or more verbs or verb patterns, such as "remove" or *et". Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="2"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Gets information about a cmdlet or function when it is used with the specified parameters ("arguments"), such as a path. The alias for ArgumentList is Args. To detect parameters that are added to a cmdlet when it is used with a particular provider, set the value of ArgumentList to a path in the provider drive, such as "HKML\Software" or "cert:\my".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Module</maml:name> <maml:description> <maml:para>Gets the commands that came from the specified modules or snap-ins. Enter the names of modules or snap-ins, or enter snap-in or module objects. You can refer to this parameter by its name, Module, or by its alias, PSSnapin. The parameter name that you choose has no effect on the command or its output. This parameter takes string values, but you can also supply a PSModuleInfo or PSSnapinInfo object, such as the objects that Get-Module, Get-PSSnapin, and Import-PSSession return. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Syntax</maml:name> <maml:description> <maml:para>Gets only specified data about the command element. * For aliases, retrieves the standard name. * For cmdlets, retrieves the syntax. * For functions and filters, retrieves the function definition. * For scripts and applications (files), retrieves the path and filename.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>TotalCount</maml:name> <maml:description> <maml:para>Gets only the specified number of command elements. You can use this parameter to limit the output of a command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="2"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Gets information about a cmdlet or function when it is used with the specified parameters ("arguments"), such as a path. The alias for ArgumentList is Args. To detect parameters that are added to a cmdlet when it is used with a particular provider, set the value of ArgumentList to a path in the provider drive, such as "HKML\Software" or "cert:\my".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>CommandType</maml:name> <maml:description> <maml:para>Gets only the specified types of commands. Use "CommandType" or its alias, "Type". By default, Get-Command gets cmdlets and functions. Valid values are: -- Alias: All Windows PowerShell aliases in the current session. -- All: All command types. It is the equivalent of "get-command *". -- Application: All non-Windows-PowerShell files in paths listed in the Path environment variable ($env:path), including .txt, .exe, and .dll files. -- Cmdlet: The cmdlets in the current session. "Cmdlet" is the default. -- ExternalScript: All .ps1 files in the paths listed in the Path environment variable ($env:path). -- Filter and Function: All Windows PowerShell functions. -- Script: Script blocks in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CommandTypes</command:parameterValue> <dev:type> <maml:name>CommandTypes</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Module</maml:name> <maml:description> <maml:para>Gets the commands that came from the specified modules or snap-ins. Enter the names of modules or snap-ins, or enter snap-in or module objects. You can refer to this parameter by its name, Module, or by its alias, PSSnapin. The parameter name that you choose has no effect on the command or its output. This parameter takes string values, but you can also supply a PSModuleInfo or PSSnapinInfo object, such as the objects that Get-Module, Get-PSSnapin, and Import-PSSession return. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets information only about the cmdlets or command elements with the specified name. <String> represents all or part of the name of the cmdlet or command element. Wildcards are permitted. To list commands with the same name in execution order, type the command name without wildcard characters. For more information, see the Notes section.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Noun</maml:name> <maml:description> <maml:para>Gets cmdlets and functions with names that include the specified noun. <String> represents one or more nouns or noun patterns, such as "process" or "*item*". Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Syntax</maml:name> <maml:description> <maml:para>Gets only specified data about the command element. * For aliases, retrieves the standard name. * For cmdlets, retrieves the syntax. * For functions and filters, retrieves the function definition. * For scripts and applications (files), retrieves the path and filename.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>TotalCount</maml:name> <maml:description> <maml:para>Gets only the specified number of command elements. You can use this parameter to limit the output of a command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Verb</maml:name> <maml:description> <maml:para>Gets information about cmdlets and functions with names that include the specified verb. <String> represents one or more verbs or verb patterns, such as "remove" or *et". Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a "Name", "Command", and "Verb" noun-property specified, or a string object to Get-Command. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Object </maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> The type of object returned depends on the type of command element retrieved. For example, Get-Command on a cmdlet retrieves a CmdletInfo object, while Get-Command on a DLL retrieves an ApplicationInfo object. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> Without parameters, "Get-Command" gets information about the Windows PowerShell cmdlets and functions. Use the parameters to qualify the elements retrieved. Unlike Get-Help, which displays the contents of XML-based help topic files, Get-Command gets its cmdlet information directly from the cmdlet code in the system. Get-Command returns the commands in alphabetical order. When the session contains more than one command with the same name, Get-Command returns the commands in execution order. The first command that is listed is the command that runs when you type the command name without qualification. For more information, see about_Command_Precedence. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets information about all of the Windows PowerShell cmdlets and functions. The default display lists the command type ("Cmdlet" or "Function" or "Filter"), the name of the cmdlet or function, and the syntax or function definition.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command -verb set | format-list </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets information about all of the cmdlets and functions with the verb "set", and it displays some of that information in a list. The list format includes fields that are omitted from the table display, including the complete syntax. To display all fields (all properties of the object), type "get-command -verb set | format-list *".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command -type cmdlet | sort-object noun | format-table -group noun </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command retrieves all of the cmdlets, sorts them alphabetically by the noun in the cmdlet name, and then displays them in noun-based groups. This display can help you find the cmdlets for a task. By default, Get-Command displays items in the order in which the system discovers them, which is also the order in which they are selected to run when a run command is ambiguous.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command -module Microsoft.PowerShell.Security, TestModule </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the commands in the Microsoft.PowerShell.Security snap-in and the Test-Module module. The Module parameter gets commands that were added by importing modules or adding Windows PowerShell snap-ins.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command get-childitem -args cert: -syntax </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command retrieves information about the Get-ChildItem cmdlet when Get-ChildItem is used with the Windows PowerShell Certificate provider. When you compare the syntax displayed in the output with the syntax that is displayed when you omit the Args (ArgumentList) parameter, you'll see that the Certificate provider dynamically adds a parameter, CodeSigningCert, to the Get-ChildItem cmdlet.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> (get-command get-childitem -ArgumentList cert:).parametersets[0].parameters | where-object { $_.IsDynamic } </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command retrieves only parameters that are added to the Get-ChildItem cmdlet dynamically when it is used with the Windows PowerShell Certificate provider. This is an alternative to the method used in the previous example. In this command, the "get-command get-childitem -ArgumentList cert:" is processed first. It requests information from Get-Command about the Get-ChildItem cmdlet when it is used with the Certificate provider. The ".parametersets[0]" selects the first parameter set (set 0) of "get-childitem -argumentList cert:" and ".parameters" selects the parameters in that parameter set. The resulting parameters are piped to the Where-Object cmdlet to test each parameter ("$_.") by using the IsDynamic property. To find the properties of the objects in a command, use Get-Member.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command * </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets information about the Windows PowerShell cmdlets, functions, filters, scripts, and aliases in the current console. It also gets information about all of the files in the paths of the Path environment variable ($env:path). It returns an ApplicationInfo object (System.Management.Automation.ApplicationInfo) for each file, not a FileInfo object (System.IO.FileInfo).</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command | where-object {$_.definition -like "*first*"} CommandType Name Definition ----------- ---- --------- Cmdlet Select-Object Select-Object [[-Property] </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command finds a cmdlet or function based on the name of one of its parameters. You can use this command to identify a cmdlet or function when all that you can recall is the name of one of its parameters. In this case, you recall that one of the cmdlets or functions has a First parameter that gets the first "n" objects in a list, but you cannot remember which cmdlet it is. This command uses the Get-Command cmdlet to get a CmdletInfo object representing each of the cmdlets and functions in the session. The CmdletInfo object has a Definition property that contains the syntax of the cmdlet or function, which includes its parameters. The command uses a pipeline operator (|) to pass the CmdletInfo object to the Where-Object cmdlet, which examines the definition (syntax) of each object ($_) for a value that includes "first". The result shows that the First parameter belongs to the Select-Object cmdlet.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command dir | format-list Name : dir CommandType : Alias Definition : Get-ChildItem ReferencedCommand : Get-ChildItem ResolvedCommand : Get-ChildItem </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Get-Command cmdlet with an alias. Although it is typically used on cmdlets, Get-Command also displays information about the code in scripts, functions, aliases, and executable files. This command displays the "dir" alias in the current console. The command pipes the result to the Format-List cmdlets.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 10 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-command notepad CommandType Name Definition ----------- ---- ---------- Application notepad.exe C:\WINDOWS\system32\notepad.exe Application NOTEPAD.EXE C:\WINDOWS\NOTEPAD.EXE </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use Get-Command to determine which command Windows PowerShell runs when it has access to multiple commands with the same name. When you use the Name parameter without wildcard characters, Get-Command lists the commands with that name in execution precedence order. This command shows which Notepad program Windows PowerShell runs when you type "Notepad" without a fully qualified path. The command uses the Name parameter without wildcard characters. The sample output shows the Notepad commands in the current console. It indicates that Windows PowerShell will run the instance of Notepad.exe in the C:\Windows\System32 directory.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 11 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> (get-command get-date).pssnapin C:\PS> (get-command remove-gpo).module </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands show how to find the snap-in or module from which a particular cmdlet originated. The first command uses the PSSnapin property of the CmdletInfo object to find the snap-in that added the Get-Date cmdlet. The second command uses the Module property of the CmdletInfo object to find the module that added the Remove-GPO cmdlet. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113309</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Command_Precedence</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Help</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSDrive</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Member</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Export-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-Help </command:name> <maml:description> <maml:para>Displays information about Windows PowerShell commands and concepts.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>Help</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-Help cmdlet displays information about Windows PowerShell concepts and commands, including cmdlets, providers, functions and scripts. To get a list of all cmdlet help topic titles, type "get-help *". If you type "Get-Help" followed by the exact name of a help topic, or by a word unique to a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not appear in any help topic titles, Get-Help displays a list of topics that include that word in their contents. In addition to "get-help", you can also type "help" or "man", which displays one screen of text at a time, or "<cmdlet-name> -?", which is identical to Get-Help but works only for cmdlets. You can display the entire help file or selected parts of the file, such as the syntax, parameters, or examples. You can also use the Online parameter to display an online version of a help file in your Internet browser. These parameters have no effect on conceptual help topics. Conceptual help topics in Windows PowerShell begin with "about_", such as "about_Comparison_Operators". To see all "about_" topics, type "get-help about_*". To see a particular topic, type "get-help about_<topic-name>", such as "get-help about_Comparison_Operators".</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-Help</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Full</maml:name> <maml:description> <maml:para>Displays the entire help file for a cmdlet, including parameter descriptions and attributes, examples, input and output object types, and additional notes. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Requests help about the specified tool or conceptual topic. Enter a cmdlet, provider, script, or function name, such as Get-Member, a conceptual topic name, such as "about_Objects", or an alias, such as "ls". Wildcards are permitted in cmdlet and provider names, but you cannot use wildcards to find the names of function help and script help topics. To get help for a script that is not located in a path that is listed in the Path environment variable, type the path and file name of the script . If you enter the exact name of a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents. The names of conceptual topics, such as about_Objects, must be entered in English, even in non-English versions of Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Category</maml:name> <maml:description> <maml:para>Displays help for items in the specified category. Valid values are Alias, Cmdlet, Provider, and HelpFile. Conceptual topics are in the HelpFile category. Category is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("about_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Component</maml:name> <maml:description> <maml:para>Displays a list of tools with the specified component value, such as "Exchange." Enter a component name. Wildcards are permitted. Component is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Functionality</maml:name> <maml:description> <maml:para>Displays help for items with the specified functionality. Enter the functionality. Wildcards are permitted. Functionality is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Online</maml:name> <maml:description> <maml:para>Displays the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. Get-Help uses the Internet address (Uniform Resource Identifier [URI]) that appears in the first item of the Related Links section of a cmdlet, function, or script help topic. This parameter works only when the help topic includes a URI that begins with "Http" or "Https" and an Internet browser is installed on the system. For information about supporting this feature in help topics that you write, see about_Comment_Based_Help, and see "How to Write Cmdlet Help" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=123415.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Path</maml:name> <maml:description> <maml:para>Gets help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter gets a customized version of a cmdlet help topic that explains how the cmdlet works in the specified Windows PowerShell provider path. This parameter is effective only for help about a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. To see the custom cmdlet help for a provider path, go to the provider path location and enter a Get-Help command or, from any path location, use the Path parameter of Get-Help to specify the provider path. For more information, see about_Providers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Role</maml:name> <maml:description> <maml:para>Displays help customized for the specified user role. Enter a role. Wildcards are permitted. Enter the role that the user plays in an organization. Some cmdlets display different text in their help files based on the value of this parameter. This parameter has no effect on help for the core cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Help</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Detailed</maml:name> <maml:description> <maml:para>Adds parameter descriptions and examples to the basic help display. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Requests help about the specified tool or conceptual topic. Enter a cmdlet, provider, script, or function name, such as Get-Member, a conceptual topic name, such as "about_Objects", or an alias, such as "ls". Wildcards are permitted in cmdlet and provider names, but you cannot use wildcards to find the names of function help and script help topics. To get help for a script that is not located in a path that is listed in the Path environment variable, type the path and file name of the script . If you enter the exact name of a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents. The names of conceptual topics, such as about_Objects, must be entered in English, even in non-English versions of Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Category</maml:name> <maml:description> <maml:para>Displays help for items in the specified category. Valid values are Alias, Cmdlet, Provider, and HelpFile. Conceptual topics are in the HelpFile category. Category is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("about_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Component</maml:name> <maml:description> <maml:para>Displays a list of tools with the specified component value, such as "Exchange." Enter a component name. Wildcards are permitted. Component is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Functionality</maml:name> <maml:description> <maml:para>Displays help for items with the specified functionality. Enter the functionality. Wildcards are permitted. Functionality is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Online</maml:name> <maml:description> <maml:para>Displays the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. Get-Help uses the Internet address (Uniform Resource Identifier [URI]) that appears in the first item of the Related Links section of a cmdlet, function, or script help topic. This parameter works only when the help topic includes a URI that begins with "Http" or "Https" and an Internet browser is installed on the system. For information about supporting this feature in help topics that you write, see about_Comment_Based_Help, and see "How to Write Cmdlet Help" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=123415.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Path</maml:name> <maml:description> <maml:para>Gets help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter gets a customized version of a cmdlet help topic that explains how the cmdlet works in the specified Windows PowerShell provider path. This parameter is effective only for help about a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. To see the custom cmdlet help for a provider path, go to the provider path location and enter a Get-Help command or, from any path location, use the Path parameter of Get-Help to specify the provider path. For more information, see about_Providers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Role</maml:name> <maml:description> <maml:para>Displays help customized for the specified user role. Enter a role. Wildcards are permitted. Enter the role that the user plays in an organization. Some cmdlets display different text in their help files based on the value of this parameter. This parameter has no effect on help for the core cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Help</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Examples</maml:name> <maml:description> <maml:para>Displays only the name, synopsis, and examples. To display only the examples, type "(get-help <cmdlet-name>).examples". This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Requests help about the specified tool or conceptual topic. Enter a cmdlet, provider, script, or function name, such as Get-Member, a conceptual topic name, such as "about_Objects", or an alias, such as "ls". Wildcards are permitted in cmdlet and provider names, but you cannot use wildcards to find the names of function help and script help topics. To get help for a script that is not located in a path that is listed in the Path environment variable, type the path and file name of the script . If you enter the exact name of a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents. The names of conceptual topics, such as about_Objects, must be entered in English, even in non-English versions of Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Category</maml:name> <maml:description> <maml:para>Displays help for items in the specified category. Valid values are Alias, Cmdlet, Provider, and HelpFile. Conceptual topics are in the HelpFile category. Category is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("about_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Component</maml:name> <maml:description> <maml:para>Displays a list of tools with the specified component value, such as "Exchange." Enter a component name. Wildcards are permitted. Component is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Functionality</maml:name> <maml:description> <maml:para>Displays help for items with the specified functionality. Enter the functionality. Wildcards are permitted. Functionality is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Online</maml:name> <maml:description> <maml:para>Displays the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. Get-Help uses the Internet address (Uniform Resource Identifier [URI]) that appears in the first item of the Related Links section of a cmdlet, function, or script help topic. This parameter works only when the help topic includes a URI that begins with "Http" or "Https" and an Internet browser is installed on the system. For information about supporting this feature in help topics that you write, see about_Comment_Based_Help, and see "How to Write Cmdlet Help" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=123415.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Path</maml:name> <maml:description> <maml:para>Gets help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter gets a customized version of a cmdlet help topic that explains how the cmdlet works in the specified Windows PowerShell provider path. This parameter is effective only for help about a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. To see the custom cmdlet help for a provider path, go to the provider path location and enter a Get-Help command or, from any path location, use the Path parameter of Get-Help to specify the provider path. For more information, see about_Providers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Role</maml:name> <maml:description> <maml:para>Displays help customized for the specified user role. Enter a role. Wildcards are permitted. Enter the role that the user plays in an organization. Some cmdlets display different text in their help files based on the value of this parameter. This parameter has no effect on help for the core cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Help</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Parameter</maml:name> <maml:description> <maml:para>Displays only the detailed descriptions of the specified parameters. Wildcards are permitted. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Requests help about the specified tool or conceptual topic. Enter a cmdlet, provider, script, or function name, such as Get-Member, a conceptual topic name, such as "about_Objects", or an alias, such as "ls". Wildcards are permitted in cmdlet and provider names, but you cannot use wildcards to find the names of function help and script help topics. To get help for a script that is not located in a path that is listed in the Path environment variable, type the path and file name of the script . If you enter the exact name of a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents. The names of conceptual topics, such as about_Objects, must be entered in English, even in non-English versions of Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Category</maml:name> <maml:description> <maml:para>Displays help for items in the specified category. Valid values are Alias, Cmdlet, Provider, and HelpFile. Conceptual topics are in the HelpFile category. Category is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("about_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Component</maml:name> <maml:description> <maml:para>Displays a list of tools with the specified component value, such as "Exchange." Enter a component name. Wildcards are permitted. Component is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Functionality</maml:name> <maml:description> <maml:para>Displays help for items with the specified functionality. Enter the functionality. Wildcards are permitted. Functionality is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Online</maml:name> <maml:description> <maml:para>Displays the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. Get-Help uses the Internet address (Uniform Resource Identifier [URI]) that appears in the first item of the Related Links section of a cmdlet, function, or script help topic. This parameter works only when the help topic includes a URI that begins with "Http" or "Https" and an Internet browser is installed on the system. For information about supporting this feature in help topics that you write, see about_Comment_Based_Help, and see "How to Write Cmdlet Help" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=123415.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Path</maml:name> <maml:description> <maml:para>Gets help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter gets a customized version of a cmdlet help topic that explains how the cmdlet works in the specified Windows PowerShell provider path. This parameter is effective only for help about a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. To see the custom cmdlet help for a provider path, go to the provider path location and enter a Get-Help command or, from any path location, use the Path parameter of Get-Help to specify the provider path. For more information, see about_Providers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Role</maml:name> <maml:description> <maml:para>Displays help customized for the specified user role. Enter a role. Wildcards are permitted. Enter the role that the user plays in an organization. Some cmdlets display different text in their help files based on the value of this parameter. This parameter has no effect on help for the core cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Category</maml:name> <maml:description> <maml:para>Displays help for items in the specified category. Valid values are Alias, Cmdlet, Provider, and HelpFile. Conceptual topics are in the HelpFile category. Category is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("about_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Component</maml:name> <maml:description> <maml:para>Displays a list of tools with the specified component value, such as "Exchange." Enter a component name. Wildcards are permitted. Component is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Detailed</maml:name> <maml:description> <maml:para>Adds parameter descriptions and examples to the basic help display. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Examples</maml:name> <maml:description> <maml:para>Displays only the name, synopsis, and examples. To display only the examples, type "(get-help <cmdlet-name>).examples". This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Full</maml:name> <maml:description> <maml:para>Displays the entire help file for a cmdlet, including parameter descriptions and attributes, examples, input and output object types, and additional notes. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Functionality</maml:name> <maml:description> <maml:para>Displays help for items with the specified functionality. Enter the functionality. Wildcards are permitted. Functionality is a property of the MamlCommandHelpInfo object that Get-Help returns. This parameter has no effect on displays of conceptual ("About_") help. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Requests help about the specified tool or conceptual topic. Enter a cmdlet, provider, script, or function name, such as Get-Member, a conceptual topic name, such as "about_Objects", or an alias, such as "ls". Wildcards are permitted in cmdlet and provider names, but you cannot use wildcards to find the names of function help and script help topics. To get help for a script that is not located in a path that is listed in the Path environment variable, type the path and file name of the script . If you enter the exact name of a help topic, Get-Help displays the topic contents. If you enter a word or word pattern that appears in several help topic titles, Get-Help displays a list of the matching titles. If you enter a word that does not match any help topic titles, Get-Help displays a list of topics that include that word in their contents. The names of conceptual topics, such as about_Objects, must be entered in English, even in non-English versions of Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Online</maml:name> <maml:description> <maml:para>Displays the online version of a help topic in the default Internet browser. This parameter is valid only for cmdlet, function, and script help topics. Get-Help uses the Internet address (Uniform Resource Identifier [URI]) that appears in the first item of the Related Links section of a cmdlet, function, or script help topic. This parameter works only when the help topic includes a URI that begins with "Http" or "Https" and an Internet browser is installed on the system. For information about supporting this feature in help topics that you write, see about_Comment_Based_Help, and see "How to Write Cmdlet Help" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=123415.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Parameter</maml:name> <maml:description> <maml:para>Displays only the detailed descriptions of the specified parameters. Wildcards are permitted. This parameter has no effect on displays of conceptual ("About_") help.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Path</maml:name> <maml:description> <maml:para>Gets help that explains how the cmdlet works in the specified provider path. Enter a Windows PowerShell provider path. This parameter gets a customized version of a cmdlet help topic that explains how the cmdlet works in the specified Windows PowerShell provider path. This parameter is effective only for help about a provider cmdlet and only when the provider includes a custom version of the provider cmdlet help topic. To see the custom cmdlet help for a provider path, go to the provider path location and enter a Get-Help command or, from any path location, use the Path parameter of Get-Help to specify the provider path. For more information, see about_Providers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Role</maml:name> <maml:description> <maml:para>Displays help customized for the specified user role. Enter a role. Wildcards are permitted. Enter the role that the user plays in an organization. Some cmdlets display different text in their help files based on the value of this parameter. This parameter has no effect on help for the core cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe objects to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.String or MamlCommandHelpInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> If you request a conceptual topic, Get-Help returns it as a string. If you specify the name of a cmdlet,, function, or script, it returns a MamlCommandHelpInfo object. Otherwise, Get-Help returns one of the formatted views that are specified in the Help.Format.ps1xml file in the $pshome directory. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> Without parameters, "Get-Help" displays information about the Windows PowerShell help system. The full view of help (-full) includes a table of information about the parameters. The table includes the following fields: -- Required: Indicates whether the parameter is required (true) or optional (false). -- Position: Indicates whether the parameter is named or positional (numbered). Positional parameters must appear in a specified place in the command. -- "Named" indicates that the parameter name is required, but that the parameter can appear anywhere in the command. -- <Number> indicates that the parameter name is optional, but when the name is omitted, the parameter must be in the place specified by the number. For example, "2" indicates that when the parameter name is omitted, the parameter must be the second (2) or only unnamed parameter in the command. When the parameter name is used, the parameter can appear anywhere in the command. -- Default value: The parameter value that Windows PowerShell uses if you do not include the parameter in the command. -- Accepts pipeline input: Indicates whether you can (true) or cannot (false) send objects to the parameter through a pipeline. "By Property Name" means that the pipelined object must have a property with the same name as the parameter name. -- Accepts wildcard characters: Indicates whether the value of a parameter can include wildcard characters, such as * and ?. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays help about the Windows PowerShell help system.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help * </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays a list of all help files in the Windows PowerShell help system.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help get-alias C:\PS>help get-alias C:\PS>get-alias -? </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands display basic information about the get-alias cmdlet. The "Get-Help" and "-?" commands display the information on a single page. The "Help" command displays the information one page at a time.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help about_* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays a list of the conceptual topics included in Windows PowerShell help. All of these topics begin with the characters "about_". To display a particular help file, type "get-help <topic-name>, for example, "get-help about_signing".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help ls -detailed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays detailed help for the Get-ChildItem cmdlet by specifying one of its aliases, "ls." The Detailed parameter requests the detailed view of the help file, which includes parameter descriptions and examples. To see the complete help file for a cmdlet, use the Full parameter.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help format-string -full </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays the full view help for the Format-String cmdlet. The full view of help includes parameter descriptions, examples, and a table of technical details about the parameters.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help start-service -examples </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays examples of using start-service in Windows PowerShell commands.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help get-childitem -parameter f* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays descriptions of the parameters of the Get-ChildItem cmdlet that begin with "f" (filter and force). For descriptions of all parameters, type "get-help get-childitem parameter*".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> (get-help write-output).syntax </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays only the syntax of the Write-Output cmdlet. Syntax is one of many properties of help objects; others are description, details, examples, and parameters. To find all properties and methods of help objects, type "get-help <cmdlet-name> | get-member"; for example, "get-help start-service | get member".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 10 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> (get-help trace-command).alertset </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays the notes about the cmdlet. The notes are stored in the alertSet property of the help object. The notes include conceptual information and tips for using the cmdlet. By default, the notes are displayed only when you use the Full parameter of Get-Help, but you can also display them by using the alertSet property.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 11 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help add-member -full | out-string -stream | select-string -pattern clixml </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to search for a word in particular cmdlet help topic. This command searches for the word "clixml" in the full version of the help topic for the Add-Member cmdlet. Because the Get-Help cmdlet generates a MamlCommandHelpInfo object, not a string, you need to use a command that transforms the help topic content into a string, such as Out-String or Out-File.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 12 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help get-member -online </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays the online version of the help topic for the Get-Member cmdlet. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 13 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help remoting </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays a list of topics that include the word "remoting" in their contents. When you enter a word that does not appear in any topic title, Get-Help displays a list of topics that include that word.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 14 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help get-item -path SQLSERVER:\DataCollection NAME Get-Item SYNOPSIS Gets a collection of Server objects for the local computer and any computers to which you have made a SQL Server PowerShell connection. ... C:\PS> cd SQLSERVER:\DataCollection C:\PS> SQLSERVER:\DataCollection> get-help get-item NAME Get-Item SYNOPSIS Gets a collection of Server objects for the local computer and any computers to which you have made a SQL Server PowerShell connection. ... C:\PS> Get-Item NAME Get-Item SYNOPSIS Gets the item at the specified location. ... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to get help for the Get-Item cmdlet that explains how to use the cmdlet in the DataCollection node of the Windows PowerShell SQL Server provider. The example shows two ways of getting the custom help for Get-Item. The first command uses the Path parameter of Get-Help to specify the provider path. This command can be entered at any path location. The second command uses the Set-Location cmdlet (alias = "cd") to go to the provider path. From that location, even without the Path parameter, the Get-Help command gets the custom help for the provider path. The third command shows that a Get-Help command in a file system path, and without the Path parameter, gets the standard help for the Get-Item cmdlet.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 15 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-help c:\ps-test\MyScript.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets help for the MyScript.ps1 script. For information about writing help for your functions and scripts, see about_Comment_Based_Help.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113316</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText></maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Comment_Based_Help</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Command</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSDrive</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Member</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-History </command:name> <maml:description> <maml:para>Gets a list of the commands entered during the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>History</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-History cmdlet gets the session history, that is, the list of commands entered during the current session. Windows PowerShell automatically maintains a history of each session. You can save the session history in XML or CSV format. By default, history files are saved in the home directory, but you can save the file in any location.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-History</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the ID number of a command in the session history. Get-History gets only the specified command. If you use Id and Count, Get-History gets the most recent commands ending with the command specified by the Id parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int64[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>Count</maml:name> <maml:description> <maml:para>Displays the specified number of the most recent history entries. The default is 32. If you use both the Count and Id parameters in a command, the display ends with the command specified by the Id parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>Count</maml:name> <maml:description> <maml:para>Displays the specified number of the most recent history entries. The default is 32. If you use both the Count and Id parameters in a command, the display ends with the command specified by the Id parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Specifies the ID number of a command in the session history. Get-History gets only the specified command. If you use Id and Count, Get-History gets the most recent commands ending with the command specified by the Id parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Int64</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a history ID to Get-History. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.PowerShell.Commands.HistoryInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Get-History returns a history object for each history item that it gets. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> The session history is a list of the commands entered during the session along with the ID. The session history represents the order of execution, the status, and the start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it. For more information about the command history, see about_History. You can also refer to Get-History by its built-in aliases, "h", "history", and "ghy". For more information, see about_Aliases. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the 32 most recently submitted commands. The default display shows each command and its ID, which indicates the order of execution.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history | where-object {$_.commandLine -like "*service*"} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets entries from the command history that include the word, "service". The first command gets the 32 most recent entries in the session history. The pipeline operator (|) passes the results to the Where-Object cmdlet, which selects only the commands that include "service".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history -id 7 -count 5 | export-csv history.csv </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the five most recent history entries ending with entry 7. The pipeline operator (|) passes the result to the Export-Csv cmdlet, which formats the history as comma-separated text and saves it in the History.csv file. The file includes the data that is displayed when you format the history as a list, including the status and start and end times of the command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history -count 1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the last (most recently entered) command in the command history. It uses the Count parameter to display just one command. By default, Get-History displays the most recent commands. This command can be abbreviated to "h -c 1" and is equivalent to pressing the up-arrow key.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history -count $MaximumHistoryCount </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays all of the commands saved in the session history. By default, $MaximumHistoryCount is 64, so this command can be abbreviated as "h -c 64".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history | format-list </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays all of the properties of entries in the session history. The pipeline operator (|) passes the result to the Format-List cmdlet, which displays all of the properties of each history entry, including the ID, status, and start and end times of the command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113317</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_history</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Clear-History</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-Job </command:name> <maml:description> <maml:para>Gets Windows PowerShell background jobs that are running in the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-Job cmdlet gets objects that represent the background jobs that were started in the current session. You can use Get-Job to get jobs that were started by using Start-Job, or by using the AsJob parameter of any cmdlet. Without parameters, a "Get-Job" command gets all jobs in the current session. You can use the parameters of Get-Job to get particular jobs. The job object that Get-Job returns contains useful information about the job, but it does not contain the job results. To get the results, use the Receive-Job cmdlet. A Windows PowerShell background job is a command that runs "in the background" without interacting with the current session. Typically, you use a background job to run a complex command that takes a long time to complete. For more information about background jobs in Windows PowerShell, see about_Jobs.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Command</maml:name> <maml:description> <maml:para>Gets the jobs that include the specified command. The default is all jobs. Enter a command (as a string). You can use wildcards to specify a command pattern.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets the job with the specified friendly names. Enter a job name, or use wildcard characters to enter a job name pattern. By default, Get-Job gets all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets only jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and to type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Job</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Gets only jobs in the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked. By default, Get-Job gets all the jobs in the current session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >NotStarted</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Running</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Completed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Failed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Stopped</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Blocked</command:parameterValue> </command:parameterValueGroup> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Command</maml:name> <maml:description> <maml:para>Gets the jobs that include the specified command. The default is all jobs. Enter a command (as a string). You can use wildcards to specify a command pattern.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>All jobs</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets only jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and to type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets the job with the specified friendly names. Enter a job name, or use wildcard characters to enter a job name pattern. By default, Get-Job gets all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Gets only jobs in the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked. By default, Get-Job gets all the jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobState</command:parameterValue> <dev:type> <maml:name>JobState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.RemotingJob</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Get-Job returns objects that represent the jobs in the session. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all background jobs started in the current session. It does not include jobs created in other sessions, even if the jobs run on the local computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = get-job -name Job1 C:\PS> $ID = $j.InstanceID C:\PS> $ID Guid ---- 03c3232e-1d23-453b-a6f4-ed73c9e29d55 C:\PS> stop-job -instanceid $ID </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands show how to get the instance ID of a job and then use it to stop a job. Unlike the name of a job, which is not unique, the instance ID is unique. The first command uses the Get-Job cmdlet to get a job. It uses the Name parameter to identify the job. The command stores the job object that Get-Job returns in the $j variable. In this example, there is only one job with the specified name. The second command gets the InstanceId property of the object in the $j variable and stores it in the $ID variable. The third command displays the value of the $ID variable. The fourth command uses Stop-Job cmdlet to stop the job. It uses the InstanceId parameter to identify the job and $ID variable to represent the instance ID of the job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job -command "*get-process*" </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the jobs on the system that include a Get-Process command. The command uses the Command parameter of Get-Job to limit the jobs retrieved. The command uses wildcard characters (*) to get jobs that include a Get-Process command anywhere within the command string.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> "*get-process*" | get-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>Like the command in the previous example, this command gets the jobs on the system that include a Get-Process command. The command uses a pipeline operator (|) to send a string (in double quotation marks) to the Get-Job cmdlet. It is the equivalent of the previous command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job -state NotStarted </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets only those jobs that have been created but have not yet been started. This includes jobs that are scheduled to run in the future and those not yet scheduled.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job -name job* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all jobs that have job names beginning with "job". Because "job<number>" is the default name for a job, this command gets all jobs that do not have an explicitly assigned name.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -scriptblock {get-process} -name MyJob C:\PS> $j = get-job -name MyJob C:\PS> $j Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 myjob Completed True localhost get-process C:\PS> receive-job -job $j Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 124 4 13572 12080 59 1140 audiodg 783 16 11428 13636 100 548 CcmExec 96 4 4252 3764 59 3856 ccmsetup ... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use Get-Job to get a job object, and then it shows how to use the job object to represent the job in a command. The first command uses the Start-Job cmdlet to start a background job that runs a Get-Process command on the local computer. The command uses the Name parameter of Start-Job to assign a friendly name to the job. The second command uses Get-Job to get the job. It uses the Name parameter of Get-Job to identify the job. The command saves the resulting job object in the $j variable. The third command displays the value of the job object in the $j variable. The value of the State property shows that the job is complete. The value of the HasMoreData property shows that there are results available from the job that have not yet been retrieved. The fourth command uses the Receive-Job cmdlet to get the results of the job. It uses the job object in the $j variable to represent the job. You can also use a pipeline operator to send a job object to Receive-Job. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -scriptblock {get-eventlog system} C:\PS> invoke-command -computername S1 -scriptblock {get-eventlog system} -AsJob C:\PS> invoke-command -computername S2 -scriptblock {start-job -scriptblock {get-eventlog system}} C:\PS> get-job Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Running True localhost get-eventlog system 2 Job2 Running True S1 get-eventlog system C:\PS> invoke-command -computername S2 -scriptblock {get-job} Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 4 Job4 Running True localhost get-eventlog system </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example demonstrates that the Get-Job cmdlet can get all of the jobs that were started in the current session, even if they were started by using different methods. The first command uses the Start-Job cmdlet to start a job on the local computer. The second command uses the AsJob parameter of Invoke-Command to start a job on the S1 computer. Even though the commands in the job run on the remote computer, the job object is created on the local computer, so you use local commands to manage the job. The third command uses the Invoke-Command cmdlet to run a Start-Job command on the S2 computer. With this method, the job object is created on the remote computer, so you use remote commands to manage the job. The fourth command uses Get-Job to get the jobs stored on the local computer. The fifth command uses Invoke-Command to run a Get-Job command on the S2 computer. The sample output shows the results of the Get-Job commands. For more information about running background jobs on remote computers, see about_Remote_Jobs.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -scriptblock {get-process} Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Failed False localhost get-process C:\PS> (get-job).jobstateinfo | format-list -property * State : Failed Reason : C:\PS> get-job | format-list * HasMoreData : False StatusMessage : Location : localhost Command : get-process JobStateInfo : Failed Finished : System.Threading.ManualResetEvent InstanceId : fb792295-1318-4f5d-8ac8-8a89c5261507 Id : 1 Name : Job1 ChildJobs : {Job2} Output : {} Error : {} Progress : {} Verbose : {} Debug : {} Warning : {} StateChanged : C:\PS> (get-job -name job2).jobstateinfo.reason Connecting to remote server using WSManCreateShellEx api failed. The async callback gave the following error message : Access is denied. </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command shows how to use the job object that Get-Job returns to investigate why a job failed. It also shows how to get the child jobs of each job. The first command uses the Start-Job cmdlet to start a job on the local computer. The job object that Start-Job returns shows that the job failed. The value of the State property is "Failed". The second command uses Get-Job to get the job object. The command uses the dot method to get the value of the JobStateInfo property of the object. It uses a pipeline operator to send the object in the JobStateInfo property to the Format-List cmdlet, which formats all of the properties of the object (*) in a list. The result of the Format-List command shows that the value of the Reason property of the job is blank. The third command investigates further. It uses a Get-Job command to get the job and then uses a pipeline operator to send the entire job object to the Format-List cmdlet, which displays all of the properties of the job in a list. The display of all properties in the job object shows that the job contains a child job named "Job2". The fourth command uses Get-Job to get the job object that represents the Job2 child job. This is the job in which the command actually ran. It uses the dot method to get the Reason property of the JobStateInfo property. The result shows that the job failed because of an "access denied" error. In this case, the user forgot to use the "Run as administrator" option when opening Windows PowerShell. Because background jobs use the remoting features of Windows PowerShell, the computer must be configured for remoting to run a job, even when the job runs on the local computer. For information about requirements for remoting in Windows PowerShell, see about_Remote_Requirements. For troubleshooting tips, see about_Remote_Troubleshooting. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113328</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Receive-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Wait-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-Module </command:name> <maml:description> <maml:para>Gets the modules that have been imported or that can be imported into the current session. </maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>Module</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-Module cmdlet gets the modules that have been imported, or that can be imported, into the session. Get-Module only gets modules; it does not import them. To import the modules into your session, use Import-Module. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-Module</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>All</maml:name> <maml:description> <maml:para>Gets module objects for all module files. Without the All parameter, Get-Module gets only the module object for the default module file. The cmdlet selects file types in the following order: manifest (.psd1) files, script module (.psm1) files, and binary module (.dll) files.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ListAvailable</maml:name> <maml:description> <maml:para>Gets all of the modules that can be imported into the session. Get-Module gets the modules in the paths specified by the $env:PSModulePath environment variable. Without this parameter, Get-Module gets only the modules that have been imported into the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only modules with the specified names or name patterns. Wildcards are permitted. You can also pipe the names to Get-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-Module</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only modules with the specified names or name patterns. Wildcards are permitted. You can also pipe the names to Get-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>All</maml:name> <maml:description> <maml:para>Gets module objects for all module files. Without the All parameter, Get-Module gets only the module object for the default module file. The cmdlet selects file types in the following order: manifest (.psd1) files, script module (.psm1) files, and binary module (.dll) files.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ListAvailable</maml:name> <maml:description> <maml:para>Gets all of the modules that can be imported into the session. Get-Module gets the modules in the paths specified by the $env:PSModulePath environment variable. Without this parameter, Get-Module gets only the modules that have been imported into the session.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only modules with the specified names or name patterns. Wildcards are permitted. You can also pipe the names to Get-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>All imported or available modules.</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe module names to Get-Module. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSModuleInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Get-Module returns objects that represent the modules. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can also refer to Get-Module by its alias, "gmo". For more information, see about_Aliases. The All parameter returns module objects for all files with a .dll file name extension, even if they do not implement cmdlets or providers. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the modules that have been imported into the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -listAvailable </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the modules that can be imported into the current session. Get-Module looks for available modules in the path specified by the $env:PSModulePath environment variable. For more information about PSModulePath, see about_Modules and about_Environment_Variables.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -listAvailable -all </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all of the exported files for all available modules.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module | get-member -type property TypeName: System.Management.Automation.PSModuleInfo Name MemberType Definition ---- ---------- ---------- AccessMode Property System.Management.Automation.ModuleAcc Description Property System.String Description {get;set;} ExportedAliases Property System.Collections.Generic.Dictionary` ExportedCmdlets Property System.Collections.Generic.Dictionary` ExportedFunctions Property System.Collections.Generic.Dictionary` ExportedVariables Property System.Collections.Generic.Dictionary` Guid Property System.Guid Guid {get;} ModuleBase Property System.String ModuleBase {get;} ModuleType Property System.Management.Automation.ModuleTyp Name Property System.String Name {get;} NestedModules Property System.Collections.ObjectModel.ReadOnl OnRemove Property System.Management.Automation.ScriptBlo Path Property System.String Path {get;} PrivateData Property System.Object PrivateData {get;set;} SessionState Property System.Management.Automation.SessionSt Version Property System.Version Version {get;} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command get the properties of the PSModuleInfo object that Get-Module returns. There is one object for each module file. You can use the properties to format and filter the module objects. For more information about the properties, see "PSModule Properties" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143624.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -listAvailable -all | format-table -property name, moduletype, path -groupby name -auto Name: MyTestCmdlets Name ModuleType Path ---- ---------- ---- MyTestCmdlets Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\TestCmdlets\TestCmdlets.dll Name: PSDiagnostics Name ModuleType Path ---- ---------- ---- PSDiagnostics Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psd1 PSDiagnostics Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psm1 Name: FileTransfer Name ModuleType Path ---- ---------- ---- FileTransfer Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all module files (imported and available) and groups them by module name. This lets you see the module files that each script is exporting.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $m = get-module -list -name FileTransfer | where {$_.moduletype -eq "Manifest"} C:\PS> get-content $m.path @{ GUID="{8FA5064B-8479-4c5c-86EA-0D311FE48875}" Author="Microsoft Corporation" CompanyName="Microsoft Corporation" Copyright="© Microsoft Corporation. All rights reserved." ModuleVersion="1.0.0.0" Description="Windows Powershell File Transfer Module" PowerShellVersion="2.0" CLRVersion="2.0" NestedModules="Microsoft.BackgroundIntelligentTransfer.Management" FormatsToProcess="FileTransfer.Format.ps1xml" RequiredAssemblies=Join-Path $psScriptRoot "Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll" } </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands display the contents of the module manifest for the Windows PowerShell File Transfer module. The first command gets the PSModuleInfo object that represent the module manifest for the File Transfer module. It saves the object in the $m variable. The second command uses dot notation to get the path to the manifest file, which is stored in the Path property of the object. Then, it uses the Get-Content cmdlet to get the content of the manifest file in the specified path. Modules are not required to have manifest files. When they do have a manifest file, a manifest is required only to include a version number. However, manifest files often provide useful information about a module, its requirements, and its contents.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -listAvailable -name FileTransfer | format-list -property * Name : FileTransfer Path : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1 Description : Powershell File Transfer Module Guid : 8fa5064b-8479-4c5c-86ea-0d311fe48875 ModuleBase : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer PrivateData : Version : 1.0.0.0 ModuleType : Manifest AccessMode : ReadWrite ExportedFunctions : {} ExportedCmdlets : {} NestedModules : {} ExportedVariables : {} ExportedAliases : {} SessionState : System.Management.Automation.SessionState OnRemove : </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command displays all of the properties of the FileTransfer module in a list. Because the module has not yet been imported into the session, the Exported* properties and the NestedModules property are not yet populated. These properties are populated only after the elements have been exported and the nested modules have been instantiated.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> dir (get-module -listavailable FileTransfer).modulebase Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 12/16/2008 12:36 PM en-US -a--- 11/19/2008 11:30 PM 16184 FileTransfer.Format.ps1xml -a--- 11/20/2008 11:30 PM 1044 FileTransfer.psd1 -a--- 12/16/2008 12:20 AM 108544 Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command lists the files in the module's directory. This is another way to determine what is in a module before you import it. Some modules might have help files or ReadMe files that describe the module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141552</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-PSSession </command:name> <maml:description> <maml:para>Gets the Windows PowerShell sessions (PSSessions) in the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>PSSession</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-PSSession cmdlet gets the Windows PowerShell sessions (PSSessions) that were created in the current session. Without parameters, Get-PSSession gets all of the PSSessions created in the current session. You can use the parameters of Get-PSSession to get the sessions that are connected to particular computers, or you can identify sessions by their names, IDs, or instance IDs. For more information about Windows PowerShell sessions, see about_PSSessions.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Gets only the PSSessions that are connected to the specified computers. Wildcards are permitted. Type the NetBIOS name, an IP address, or a fully-qualified domain name of one or more computers. To specify the local computer, type the computer name, "localhost", or a dot (.).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-PSSession</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified IDs. Type one or more IDs (separated by commas), or use the range operator (..) to specify a range of IDs. An ID is an integer that uniquely identifies the PSSession in the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. To find the ID of a PSSession, use Get-PSSession without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified instance IDs. The instance ID is a GUID that uniquely identifies a PSSession on a local or remote computer. The InstanceID is unique, even when you have multiple sessions running in Windows PowerShell. The InstanceID is stored in the InstanceID property of the object that represents a PSSession. To find the InstanceID of the PSSessions in the current session, type "get-pssession | format-table Name, ComputerName, InstanceId".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified friendly names. Wildcards are permitted. To find the names of the PSSessions in the current session, type "get-pssession" without parameters. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Gets only the PSSessions that are connected to the specified computers. Wildcards are permitted. Type the NetBIOS name, an IP address, or a fully-qualified domain name of one or more computers. To specify the local computer, type the computer name, "localhost", or a dot (.).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified IDs. Type one or more IDs (separated by commas), or use the range operator (..) to specify a range of IDs. An ID is an integer that uniquely identifies the PSSession in the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. To find the ID of a PSSession, use Get-PSSession without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>All sessions in the shell</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified instance IDs. The instance ID is a GUID that uniquely identifies a PSSession on a local or remote computer. The InstanceID is unique, even when you have multiple sessions running in Windows PowerShell. The InstanceID is stored in the InstanceID property of the object that represents a PSSession. To find the InstanceID of the PSSessions in the current session, type "get-pssession | format-table Name, ComputerName, InstanceId".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the PSSessions with the specified friendly names. Wildcards are permitted. To find the names of the PSSessions in the current session, type "get-pssession" without parameters. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.Runspaces.PSSession</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Get-PSSession returns a PSSession object for each PSSession that it gets. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> Get-PSSession gets the PSSessions that were created in the current session. It does not get the session that is created when you open Windows PowerShell, and it does not get PSSessions that were created in other sessions or on other computers, even if they connect to the local computer. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all of the PSSessions that were created in the current session. It does not get PSSessions that were created in other sessions or on other computers, even if they connect to this computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = get-pssession -computername Server02 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the PSSessions that are connected to the Server02 computer and saves them in the $p variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-pssession -computername Server01, Server02, Server03 C:\PS> $s1, $s2, $s3 = get-pssession </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to save the results of a Get-PSSession command in multiple variables. The first command uses the New-PSSession cmdlet to create PSSessions on three remote computers. The second command uses a Get-PSSession cmdlet to get the three PSSessions. It then saves each of the PSSessions in a separate variable. When Windows PowerShell assigns an array of objects to an array of variables, it assigns the first object to the first variable, the second object to the second variable, and so on. If there are more objects than variables, it assigns all remaining objects to the last variable in the array. If there are more variables than objects, the extra variables are not used.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession | format-table -property computername, InstanceID C:\PS> $s = get-pssession -InstanceID a786be29-a6bb-40da-80fb-782c67f7db0f C:\PS> remove-pssession -session $s </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to get a PSSession by using its instance ID, and then to delete the PSSession. The first command gets all of the PSSessions on the local computer. It sends the PSSessions to the Format-Table cmdlet, which displays the ComputerName and InstanceID properties of each PSSession. The second command uses the Get-PSSession cmdlet to get a particular PSSession and to save it in the $s variable. The command uses the InstanceID parameter to identify the PSSession. The third command uses the Remove-PSSession cmdlet to delete the PSSession in the $s variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession -computername Serv* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets all the PSSessions that connect to computers that have computer names that begin with "Serv". </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession -name Test*, Ux* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets PSSessions that have names that begin with "Test" or "Ux".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession 2 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the PSSession with ID 2. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135219</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exit-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-PSSessionConfiguration </command:name> <maml:description> <maml:para>Gets the registered session configurations on the computer. </maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-PSSessionConfiguration cmdlet gets the session configurations that have been registered on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. To create and register a session configuration, use the Register-PSSessionConfiguration cmdlet.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-PSSessionConfiguration</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the session configurations with the specified name or name pattern. Enter one or more session configuration names. Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the session configurations with the specified name or name pattern. Enter one or more session configuration names. Wildcards are permitted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>All session configurations on the local computer</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name> Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must open Windows PowerShell with the "Run as administrator" option. To view the session configurations on the computer, you must be a member of the Administrators group on the computer. To run a Get-PSSessionConfiguration command on a remote computer, Credential Security Service Provider (CredSSP) authentication must be enabled in the client settings on the local computer (by using the Enable-WSManCredSSP cmdlet) and in the service settings on the remote computer, and you must use the CredSSP value of the Authentication parameter when establishing the remote session. Otherwise, access is denied. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssessionconfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the session configurations on the computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssessionconfiguration -name Microsoft* Name PSVersion StartupScript Permission ---- --------- ------------- ---------- microsoft.powershell 2.0 BUILTIN\Administrators AccessAll... microsoft.powershell32 2.0 BUILTIN\Administrators AccessAll... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Name parameter of Get-PSSessionConfiguration to get only the session configurations with names that begin with "Microsoft". This command gets the two default session configurations that come with Windows PowerShell.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Get-PSSessionConfiguration -name microsoft.powershell | get-member TypeName: Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Capability NoteProperty System.Object[] Capability=System.Object[] ExactMatch NoteProperty System.String ExactMatch=False Filename NoteProperty System.String Filename=%windir%\system32\pwrshplugin.dll lang NoteProperty System.String lang=en-US Name NoteProperty System.String Name=microsoft.powershell PSVersion NoteProperty System.String PSVersion=2.0 ResourceUri NoteProperty System.String ResourceUri=http://schemas.microsoft.com/powershell/microsoft.powershell SDKVersion NoteProperty System.String SDKVersion=1 SecurityDescriptorSddl NoteProperty System.String SecurityDescriptorSddl=O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD) SupportsOptions NoteProperty System.String SupportsOptions=true Uri NoteProperty System.String Uri=http://schemas.microsoft.com/powershell/microsoft.powershell xmlns NoteProperty System.String xmlns=http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration XmlRenderingType NoteProperty System.String XmlRenderingType=text Permission ScriptProperty System.Object Permission {get=trap { continue; }... C:\PS> Get-PSSessionConfiguration -name microsoft.powershell | format-list -property * Name : microsoft.powershell Filename : %windir%\system32\pwrshplugin.dll SDKVersion : 1 XmlRenderingType : text lang : en-US PSVersion : 2.0 ResourceUri : http://schemas.microsoft.com/powershell/microsoft.powershell SupportsOptions : true Capability : {Shell} Uri : http://schemas.microsoft.com/powershell/microsoft.powershell SecurityDescriptorSddl : O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD) ExactMatch : False xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration Permission : BUILTIN\Administrators AccessAllowed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands examine the PSSessionConfiguration object that Get-PSSessionConfiguration returns. The first command uses the Get-PSSessionConfiguration cmdlet to get the Microsoft.PowerShell default configuration. The second command uses a pipeline operator (|) to send the object that Get-PSSessionConfiguration returns to the Get-Member cmdlet. The output shows the properties and methods of the object. The third command sends the same object to the Format-List cmdlet. The Property parameter with a value of * (all) directs Format-List to display all of the properties and property values of the object in a list. The output of this command has very useful information, including the location of the .dll that implements the configuration type, the resource Uniform Resource Identifier (URI) for the endpoint that is created, and the Security Descriptor Definition Language (SDDL) for the configuration. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> dir wsman:\localhost\plugin WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin Name Type Keys ---- ---- ---- Event Forwarding Plugin Container {Name=Event Forwarding Plugin} MaintenanceShell Container {Name=MaintenanceShell} microsoft.powershell Container {Name=microsoft.powershell} microsoft.powershell32 Container {Name=microsoft.powershell32} WMI Provider Container {Name=WMI Provider} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Get-ChildItem cmdlet (alias = dir) in the WSMan: provider drive to look at the content of the Plugin node. This is another way to look at the session configurations on the computer. The PlugIn node contains ContainerElement objects (Microsoft.WSMan.Management.WSManConfigContainerElement) that represent the registered Windows PowerShell session configurations, along with other plug-ins for WS-Management.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enable-wsmanCredSSP -delegate server02 C:\PS> connect-wsman server02 C:\PS> set-item wsman:\server02*\service\auth\credSSP -value $true C:\PS> invoke-command -scriptblock {Get-PSSessionConfiguration} -computername Server02 -authentication CredSSP -credential Domain01\Admin01 Name PSVersion StartupScript Permission PSComputerName ---- --------- ------------- ---------- -------------- microsoft.powershell 2.0 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com microsoft.powershell32 2.0 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com MyX86Shell 2.0 c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to run a Get-PSSessionConfiguration command on a remote computer. The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the service settings on the remote computer. To run the commands in this example, you must be a member of the Administrators group on the local computer and the remote computer. The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer to the Server02 remote computer. This configures the CredSSP client setting on the local computer. The second command uses the Connect-WSMan cmdlet to connect to the Server02 computer. This action adds a node for the Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management settings on the Server02 computer. The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Server02 computer to True. This configures the service settings on the remote computer. The fourth command uses the Invoke-Command cmdlet to run a Get-PSSessionConfiguration command on the Server02 computer. The command uses the Credential parameter, and it uses the Authentication parameter with a value of CredSSP.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> (get-PSSessionConfiguration -name CustomShell).resourceURI http://schemas.microsoft.com/powershell/microsoft.CustomShell </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Get-PSSessionConfiguration cmdlet to get the resource URI of a session configuration. This command is useful when setting the value of the $PSSessionConfigurationName preference variable, which takes a resource URI. The $PSSessionConfiguationName variable specifies the default configuration that is used when you create a session. This variable is set on the local computer, but it specifies a configuration on the remote computer. For more information about the $PSSessionConfiguration variable, see about_Preference_Variables.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144304</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Get-PSSnapin </command:name> <maml:description> <maml:para>Gets the Windows PowerShell snap-ins on the computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Get</command:verb> <command:noun>PSSnapin</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Get-PSSnapin cmdlet gets the Windows PowerShell snap-ins that have been added to the current session or that have been registered on the system. The snap-ins are listed in the order in which they are detected. Get-PSSnapin gets only registered snap-ins. To register a Windows PowerShell snap-in, use the InstallUtil tool included with the Microsoft .NET Framework 2.0. For more information, see "How to Register Cmdlets, Providers, and Host Applications" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143619.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Get-PSSnapin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the specified Windows PowerShell snap-ins. Enter the names of one or more Windows PowerShell snap-ins. Wildcards are permitted. The parameter name ("Name") is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Registered</maml:name> <maml:description> <maml:para>Gets the Windows PowerShell snap-ins that have been registered on the system (even if they have not yet been added to the session). The snap-ins that are installed with Windows PowerShell do not appear in this list. Without this parameter, Get-PSSnapin gets the Windows PowerShell snap-ins that have been added to the session.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets only the specified Windows PowerShell snap-ins. Enter the names of one or more Windows PowerShell snap-ins. Wildcards are permitted. The parameter name ("Name") is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Registered</maml:name> <maml:description> <maml:para>Gets the Windows PowerShell snap-ins that have been registered on the system (even if they have not yet been added to the session). The snap-ins that are installed with Windows PowerShell do not appear in this list. Without this parameter, Get-PSSnapin gets the Windows PowerShell snap-ins that have been added to the session.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to Get-PSSnapin. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSSnapInInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Get-PSSnapin returns an object for each snap-in that it gets. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can refer to Get-PSSnapin by its built-in alias, "psnp". For more information, see about_Aliases. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-PSSnapIn </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the Windows PowerShell snap-ins that are currently loaded in the session. This includes the snap-ins that are installed with Windows PowerShell and those that have been added to the session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-PSSnapIn -registered </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the Windows PowerShell snap-ins that have been registered on the computer, including those that have already been added to the session. The output does not include snap-ins that are installed with Windows PowerShell or Windows PowerShell snap-in dynamic-link libraries (DLLs) that have not yet been registered on the system.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-PSSnapIn smp* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the Windows PowerShell snap-ins in the current session that have names that begin with "smp".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113330</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Import-Module </command:name> <maml:description> <maml:para>Adds modules to the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Import</command:verb> <command:noun>Module</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Import-Module cmdlet adds one or more modules to the current session. A module is a package that contains members (such as cmdlets, providers, scripts, functions, variables, and other tools and files) that can be used in Windows PowerShell. After a module is imported, you can use the module members in your session. To import a module, use the Name, Assembly, or ModuleInfo parameter to identify the module to import. By default, Import-Module imports all members that the module exports, but you can use the Alias, Function, Cmdlet, and Variable parameters to restrict the members that are imported. Import-Module imports a module only into the current session. To import the module into all sessions, add an Import-Module command to your Windows PowerShell profile. For more information about profiles, see about_Profiles. For more information about modules, see about_Modules.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Import-Module</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of the modules to import. Enter the name of the module or the name of a file in the module, such as a .psd1, .psm1, .dll, or ps1 file. File paths are optional. Wildcards are not permitted. You can also pipe module names and file names to Import-Module. If you omit a path, Import-Module looks for the module in the paths saved in the PSModulePath environment variable ($env:PSModulePath). Specify only the module name whenever possible. When you specify a file name, only the members that are implemented in that file are imported. If the module contains other files, they are not imported, and you might be missing important members of the module. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Imports only the specified aliases from the module into the current session. Enter a comma-separated list of aliases. Wildcard characters are permitted. Some modules automatically export selected aliases into your session when you import the module. This parameter lets you select from among the exported aliases. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to a script module during the Import-Module command. This parameter is valid only when you are importing a script module. You can also refer to ArgumentList by its alias, "args". For more information, see about_Aliases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the imported module members. This parameter is valid only for script modules. When you use the AsCustomObject parameter, Import-Module imports the module members into the session and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Imports only the specified cmdlets from the module into the current session. Enter a list of cmdlets. Wildcard characters are permitted. Some modules automatically export selected cmdlets into your session when you import the module. This parameter lets you select from among the exported cmdlets. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Re-imports a module and its members, even if the module or its members have an access mode of read-only.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Imports only the specified functions from the module into the current session. Enter a list of functions. Wildcard characters are permitted. Some modules automatically export selected functions into your session when you import the module. This parameter lets you select from among the exported functions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Global</maml:name> <maml:description> <maml:para>When used in a script module (.psm1), this parameter imports modules into the global session state. This parameter is effective only when it appears in a script module. Otherwise, it is ignored. By default, the commands in a script module, including commands from nested modules, are imported into the caller's session state. To restrict the commands that a module exports, use an Export-ModuleMember command in the script module.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns objects that represent the modules that were imported. By default, this cmdlet does not generate any output. Notes -- When you pipe the output of a "get-module -listavailable" command to an Import-Module command with the PassThru parameter, Import-Module returns the object that Get-Module passed to it without updating the object. As a result, the Exported and NestedModules properties are not yet populated. -- When you use the Prefix parameter to specify a prefix for the member, the prefix does not appear in the member names in the properties of the module object. The object records what was exported before the prefix was applied.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Prefix</maml:name> <maml:description> <maml:para>Adds the specified prefix to the nouns in the names of imported module members. Use this parameter to avoid name conflicts that might occur when different members in the session have the same name. This parameter does not change the module, and it does not affect files that the module imports for its own use (known as "nested modules"). It affects only the names of members in the current session. For example, if you specify the prefix "UTC" and then import a Get-Date cmdlet, the cmdlet is known in the session as Get-UTCDate, and it is not confused with the original Get-Date cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Imports only the specified variables from the module into the current session. Enter a list of variables. Wildcard characters are permitted. Some modules automatically export selected variables into your session when you import the module. This parameter lets you select from among the exported variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the version of the module to import. Use this parameter when you have different versions of the same module on your system.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Import-Module</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Assembly</maml:name> <maml:description> <maml:para>Imports the cmdlets and providers implemented in the specified assembly objects. Enter a variable that contains assembly objects or a command that creates assembly objects. You can also pipe an assembly object to Import-Module. When you use this parameter, only the cmdlets and providers implemented by the specified assemblies are imported. If the module contains other files, they are not imported, and you might be missing important members of the module. Use this parameter for debugging and testing the module, or when you are instructed to use it by the module author.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Assembly[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Imports only the specified aliases from the module into the current session. Enter a comma-separated list of aliases. Wildcard characters are permitted. Some modules automatically export selected aliases into your session when you import the module. This parameter lets you select from among the exported aliases. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to a script module during the Import-Module command. This parameter is valid only when you are importing a script module. You can also refer to ArgumentList by its alias, "args". For more information, see about_Aliases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the imported module members. This parameter is valid only for script modules. When you use the AsCustomObject parameter, Import-Module imports the module members into the session and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Imports only the specified cmdlets from the module into the current session. Enter a list of cmdlets. Wildcard characters are permitted. Some modules automatically export selected cmdlets into your session when you import the module. This parameter lets you select from among the exported cmdlets. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Re-imports a module and its members, even if the module or its members have an access mode of read-only.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Imports only the specified functions from the module into the current session. Enter a list of functions. Wildcard characters are permitted. Some modules automatically export selected functions into your session when you import the module. This parameter lets you select from among the exported functions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Global</maml:name> <maml:description> <maml:para>When used in a script module (.psm1), this parameter imports modules into the global session state. This parameter is effective only when it appears in a script module. Otherwise, it is ignored. By default, the commands in a script module, including commands from nested modules, are imported into the caller's session state. To restrict the commands that a module exports, use an Export-ModuleMember command in the script module.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns objects that represent the modules that were imported. By default, this cmdlet does not generate any output. Notes -- When you pipe the output of a "get-module -listavailable" command to an Import-Module command with the PassThru parameter, Import-Module returns the object that Get-Module passed to it without updating the object. As a result, the Exported and NestedModules properties are not yet populated. -- When you use the Prefix parameter to specify a prefix for the member, the prefix does not appear in the member names in the properties of the module object. The object records what was exported before the prefix was applied.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Prefix</maml:name> <maml:description> <maml:para>Adds the specified prefix to the nouns in the names of imported module members. Use this parameter to avoid name conflicts that might occur when different members in the session have the same name. This parameter does not change the module, and it does not affect files that the module imports for its own use (known as "nested modules"). It affects only the names of members in the current session. For example, if you specify the prefix "UTC" and then import a Get-Date cmdlet, the cmdlet is known in the session as Get-UTCDate, and it is not confused with the original Get-Date cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Imports only the specified variables from the module into the current session. Enter a list of variables. Wildcard characters are permitted. Some modules automatically export selected variables into your session when you import the module. This parameter lets you select from among the exported variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the version of the module to import. Use this parameter when you have different versions of the same module on your system.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Import-Module</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>ModuleInfo</maml:name> <maml:description> <maml:para>Specifies module objects to import. Enter a variable that contains the module objects, or a command that gets the module objects, such as a "get-module -listavailable" command. You can also pipe module objects to Import-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSModuleInfo[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Imports only the specified aliases from the module into the current session. Enter a comma-separated list of aliases. Wildcard characters are permitted. Some modules automatically export selected aliases into your session when you import the module. This parameter lets you select from among the exported aliases. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to a script module during the Import-Module command. This parameter is valid only when you are importing a script module. You can also refer to ArgumentList by its alias, "args". For more information, see about_Aliases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the imported module members. This parameter is valid only for script modules. When you use the AsCustomObject parameter, Import-Module imports the module members into the session and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Imports only the specified cmdlets from the module into the current session. Enter a list of cmdlets. Wildcard characters are permitted. Some modules automatically export selected cmdlets into your session when you import the module. This parameter lets you select from among the exported cmdlets. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Re-imports a module and its members, even if the module or its members have an access mode of read-only.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Imports only the specified functions from the module into the current session. Enter a list of functions. Wildcard characters are permitted. Some modules automatically export selected functions into your session when you import the module. This parameter lets you select from among the exported functions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Global</maml:name> <maml:description> <maml:para>When used in a script module (.psm1), this parameter imports modules into the global session state. This parameter is effective only when it appears in a script module. Otherwise, it is ignored. By default, the commands in a script module, including commands from nested modules, are imported into the caller's session state. To restrict the commands that a module exports, use an Export-ModuleMember command in the script module.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns objects that represent the modules that were imported. By default, this cmdlet does not generate any output. Notes -- When you pipe the output of a "get-module -listavailable" command to an Import-Module command with the PassThru parameter, Import-Module returns the object that Get-Module passed to it without updating the object. As a result, the Exported and NestedModules properties are not yet populated. -- When you use the Prefix parameter to specify a prefix for the member, the prefix does not appear in the member names in the properties of the module object. The object records what was exported before the prefix was applied.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Prefix</maml:name> <maml:description> <maml:para>Adds the specified prefix to the nouns in the names of imported module members. Use this parameter to avoid name conflicts that might occur when different members in the session have the same name. This parameter does not change the module, and it does not affect files that the module imports for its own use (known as "nested modules"). It affects only the names of members in the current session. For example, if you specify the prefix "UTC" and then import a Get-Date cmdlet, the cmdlet is known in the session as Get-UTCDate, and it is not confused with the original Get-Date cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Imports only the specified variables from the module into the current session. Enter a list of variables. Wildcard characters are permitted. Some modules automatically export selected variables into your session when you import the module. This parameter lets you select from among the exported variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the version of the module to import. Use this parameter when you have different versions of the same module on your system.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Alias</maml:name> <maml:description> <maml:para>Imports only the specified aliases from the module into the current session. Enter a comma-separated list of aliases. Wildcard characters are permitted. Some modules automatically export selected aliases into your session when you import the module. This parameter lets you select from among the exported aliases. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to a script module during the Import-Module command. This parameter is valid only when you are importing a script module. You can also refer to ArgumentList by its alias, "args". For more information, see about_Aliases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the imported module members. This parameter is valid only for script modules. When you use the AsCustomObject parameter, Import-Module imports the module members into the session and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Assembly</maml:name> <maml:description> <maml:para>Imports the cmdlets and providers implemented in the specified assembly objects. Enter a variable that contains assembly objects or a command that creates assembly objects. You can also pipe an assembly object to Import-Module. When you use this parameter, only the cmdlets and providers implemented by the specified assemblies are imported. If the module contains other files, they are not imported, and you might be missing important members of the module. Use this parameter for debugging and testing the module, or when you are instructed to use it by the module author.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Assembly[]</command:parameterValue> <dev:type> <maml:name>Assembly[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Imports only the specified cmdlets from the module into the current session. Enter a list of cmdlets. Wildcard characters are permitted. Some modules automatically export selected cmdlets into your session when you import the module. This parameter lets you select from among the exported cmdlets. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Re-imports a module and its members, even if the module or its members have an access mode of read-only.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Imports only the specified functions from the module into the current session. Enter a list of functions. Wildcard characters are permitted. Some modules automatically export selected functions into your session when you import the module. This parameter lets you select from among the exported functions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Global</maml:name> <maml:description> <maml:para>When used in a script module (.psm1), this parameter imports modules into the global session state. This parameter is effective only when it appears in a script module. Otherwise, it is ignored. By default, the commands in a script module, including commands from nested modules, are imported into the caller's session state. To restrict the commands that a module exports, use an Export-ModuleMember command in the script module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>ModuleInfo</maml:name> <maml:description> <maml:para>Specifies module objects to import. Enter a variable that contains the module objects, or a command that gets the module objects, such as a "get-module -listavailable" command. You can also pipe module objects to Import-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSModuleInfo[]</command:parameterValue> <dev:type> <maml:name>PSModuleInfo[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of the modules to import. Enter the name of the module or the name of a file in the module, such as a .psd1, .psm1, .dll, or ps1 file. File paths are optional. Wildcards are not permitted. You can also pipe module names and file names to Import-Module. If you omit a path, Import-Module looks for the module in the paths saved in the PSModulePath environment variable ($env:PSModulePath). Specify only the module name whenever possible. When you specify a file name, only the members that are implemented in that file are imported. If the module contains other files, they are not imported, and you might be missing important members of the module. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns objects that represent the modules that were imported. By default, this cmdlet does not generate any output. Notes -- When you pipe the output of a "get-module -listavailable" command to an Import-Module command with the PassThru parameter, Import-Module returns the object that Get-Module passed to it without updating the object. As a result, the Exported and NestedModules properties are not yet populated. -- When you use the Prefix parameter to specify a prefix for the member, the prefix does not appear in the member names in the properties of the module object. The object records what was exported before the prefix was applied.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Prefix</maml:name> <maml:description> <maml:para>Adds the specified prefix to the nouns in the names of imported module members. Use this parameter to avoid name conflicts that might occur when different members in the session have the same name. This parameter does not change the module, and it does not affect files that the module imports for its own use (known as "nested modules"). It affects only the names of members in the current session. For example, if you specify the prefix "UTC" and then import a Get-Date cmdlet, the cmdlet is known in the session as Get-UTCDate, and it is not confused with the original Get-Date cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Imports only the specified variables from the module into the current session. Enter a list of variables. Wildcard characters are permitted. Some modules automatically export selected variables into your session when you import the module. This parameter lets you select from among the exported variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the version of the module to import. Use this parameter when you have different versions of the same module on your system.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String, System.Management.Automation.PSModuleInfo, System.Reflection.Assembly</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a module name, module object, or assembly object to Import-Module. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None, System.Management.Automation.PSModuleInfo, or System.Management.Automation.PSCustomObject</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> By default, Import-Module does not generate any output. If you use the PassThru parameter, it generates a System.Management.Automation.PSModuleInfo object that represents the module. If you use the AsCustomObject parameter, it generates a PSCustomObject object. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can also refer to Import-Module by its alias, "ipmo". For more information, see about_Aliases. Before you can import a module, the module directory must be copied to a directory that is accessible to your local computer. For more information, see about_Modules. Module members run in their own private module session state, so the commands that they use for internal processing do not affect your session state. If you import members with the same name and the same type into your session, Windows PowerShell uses the member imported last by default. Variables and aliases are replaced, and the originals are not accessible. Functions, cmdlets and providers are merely "shadowed" by the new members, and they can be accessed by qualifying the command name with the name of its snap-in, module, or function path. To update the formatting data for commands that have been imported from a module, use the Update-FormatData cmdlet. Update-FormatData also updates the formatting data for commands in the session that were imported from modules. If the formatting file for a module changes, you can run an Update-FormatData command to update the formatting data for imported commands. You do not need to import the module again. To import a module that is created by Import-PSSession or Export-PSSession, the execution policy in the current session cannot be Restricted or AllSigned, because the modules that Import-PSSession and Export-PSSession create contains unsigned script files that are prohibited by these policies. To use Import-Module without changing the execution policy for the local computer, use the Scope parameter of Set-ExecutionPolicy to set a less restrictive execution policy for a single process. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-module -name BitsTransfer </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command imports the members of the BitsTransfer module into the current session. The Name parameter name (-Name) is optional and can be omitted. By default, Import-Module does not generate any output when it imports a module. To request output, use the PassThru or AsCustomObject parameter, or the Verbose common parameter.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -listAvailable | import-module </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command imports all available modules in the path specified by the PSModulePath environment variable ($env:psmodulepath) into the current session. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $m = get-module -ListAvailable BitsTransfer, ServerBackup C:\PS> import-module -moduleInfo $m </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands import the members of the BitsTransfer and ServerBackup modules into the current session. The first command uses the Get-Module cmdlet to get PSModuleInfo objects that represent the BitsTransfer and ServerBackup modules. It saves the objects in the $m variable. The ListAvailable parameter is required when you are getting modules that are not yet imported into the session. The second command uses the ModuleInfo parameter of Import-Module to import the modules into the current session. These commands are equivalent to using a pipeline operator (|) to send the output of a Get-Module command to Import-Module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-module -name c:\ps-test\modules\test -verbose VERBOSE: Loading module from path 'C:\ps-test\modules\Test\Test.psm1'. VERBOSE: Exporting function 'my-parm'. VERBOSE: Exporting function 'get-parm'. VERBOSE: Exporting function 'get-spec'. VERBOSE: Exporting function 'get-specDetails'. </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses an explicit path to identify the module to import. It also uses the Verbose common parameter to get a list of the items imported from the module. Without the Verbose, PassThru, or AsCustomObject parameter, Import-Module does not generate any output when it imports a module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-module BitsTransfer -cmdlet Add-BitsTransferFile, Get-BitsTransfer C:\PS> get-module BitsTransfer Name : BitsTransfer Path : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1 Description : Guid : 8fa5064b-8479-4c5c-86ea-0d311fe48875 Version : 1.0.0.0 ModuleBase : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer ModuleType : Manifest PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {[Add-BitsTransfer, Add-BitsTransfer], [Complete-BitsTransfer, Complete-BitsTransfer], [Get-BitsTransfer, Get-BitsTransfer], [Rem ove-BitsTransfer, Remove-BitsTransfer]...} ExportedFunctions : {} ExportedVariables : {} NestedModules : {Microsoft.BackgroundIntelligentTransfer.Management} C:\PS> get-command -module BitsTransfer CommandType Name Definition ----------- ---- ---------- Cmdlet Add-BitsTransfer Add-BitsTransfer [-BitsJob] <BitsJob[]> [-Source] <String[]> [[-Destination] <String[]>] [-Verbose] [-Debug] [-ErrorA... Cmdlet Get-BitsTransfer Get-BitsTransfer [[-Name] <String[]>] [-AllUsers] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-WarningActi... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to restrict the module members that are imported into the session and the effect of this command on the session. The first command imports only the Add-BitsTransfer and Get-BitsTransfer cmdlets from the BitsTransfer module. The command uses the Cmdlet parameter to restrict the cmdlets that the module imports. You can also use the Alias, Variable, and Function parameters to restrict other members that a module imports. The second command uses the Get-Module cmdlet to get the object that represents the BitsTransfer module. The ExportedCmdlets property lists all of the cmdlets that the module exports, even when they were not all imported. The third command uses the Module parameter of the Get-Command cmdlet to get the commands that were imported from the BitsTransfer module. The results confirm that only the Add-BitsTransfer and Get-BitsTransfer cmdlets were imported.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-module BitsTransfer -prefix PS -passthru Name : bitstransfer Path : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\bitstransfer\bitstransfer.psd1 Description : Guid : 8fa5064b-8479-4c5c-86ea-0d311fe48875 Version : 1.0.0.0 ModuleBase : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\bitstransfer ModuleType : Manifest PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {[Add-BitsTransfer, Add-BitsTransfer], [Remove-BitsTransfer, Remove-BitsTransfer], [Complete-BitsTransfer, Complete-BitsTransfer] , [Get-BitsTransfer, Get-BitsTransfer]...} ExportedFunctions : {} ExportedVariables : {} NestedModules : {Microsoft.BackgroundIntelligentTransfer.Management} C:\PS> get-command -module bitstransfer CommandType Name Definition ----------- ---- ---------- Cmdlet Add-PSBitsTransfer Add-PSBitsTransfer [-BitsJob] <BitsJob[]> [-Source] <String[]> ... Cmdlet Complete-PSBitsTransfer Complete-PSBitsTransfer [-BitsJob] <BitsJob[]> [-Verbose] [-Deb... Cmdlet Get-PSBitsTransfer Get-PSBitsTransfer [[-Name] <String[]>] [-AllUsers] [-Verbose] ... Cmdlet Remove-PSBitsTransfer Remove-PSBitsTransfer [-BitsJob] <BitsJob[]> [-Verbose] [-Debug... Cmdlet Resume-PSBitsTransfer Resume-PSBitsTransfer [-BitsJob] <BitsJob[]> [-Asynchronous] [-... Cmdlet Set-PSBitsTransfer Set-PSBitsTransfer [-BitsJob] <BitsJob[]> [-DisplayName <String... Cmdlet Start-PSBitsTransfer Start-PSBitsTransfer [[-Source] <String[]>] [[-Destination] <St... Cmdlet Suspend-PSBitsTransfer Suspend-PSBitsTransfer [-BitsJob] <BitsJob[]> [-Verbose] [-Debu... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands import the BitsTransfer module into the current session, add a prefix to the member names, and then display the prefixed member names. The first command uses the Import-Module cmdlet to import the BitsTransfer module. It uses the Prefix parameter to add the PS prefix to all members that are imported from the module and the PassThru parameter to return a module object that represents the imported module. The module object that the command returns has an ExportedCmdlets property that lists the exported members. The prefix does not appear in the cmdlet names, because it is applied after the members are exported (but before they are imported). The second command uses the Get-Command cmdlet to get the members that have been imported from the module. It uses the Module parameter to specify the module. The output shows that the module members were correctly prefixed. The prefix that you use applies only to the members in the current session. It does not change the module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module -list | format-table -property name, moduletype -auto Name ModuleType ---- ---------- Show-Calendar Script BitsTransfer Manifest PSDiagnostics Manifest TestCmdlets Script C:\PS> $a = import-module -name Show-Calendar -asCustomObject C:\PS> $a | get-member TypeName: System.Management.Automation.PSCustomObject Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Show-Calendar ScriptMethod System.Object Show-Calendar(); C:\PS> $a."show-calendar"() </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands demonstrate how to get and use the custom object that Import-Module returns. Custom objects include synthetic members that represent each of the imported module members. For example, the cmdlets and functions in a module are converted to script methods of the custom object. Custom objects are very useful in scripting. They are also useful when several imported objects have the same names. Using the script method of an object is equivalent to specifying the fully qualified name of an imported member, including its module name. The AsCustomObject parameter can be used only with a script module, so the first task is to determine which of the available modules is a script module. The first command uses the Get-Module cmdlet to get the available modules. The command uses a pipeline operator (|) to pass the module objects to the Format-Table cmdlet, which lists the Name and ModuleType of each module in a table. The second command uses the Import-Module cmdlet to import the Show-Calendar script module. The command uses the AsCustomObject parameter to request a custom object. The command saves the resulting custom object in the $a variable. The third command uses a pipeline operator to send the $a variable to the Get-Member cmdlet, which gets the properties and methods of the PSCustomObject in $a. The output shows a Show-Calendar script method. The last command uses the Show-Calendar script method. The method name must be enclosed in quotation marks, because it includes a hyphen.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> import-module BitsTransfer C:\PS> import-module BitsTransfer -force -prefix PS </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Force parameter of Import-Module when you are re-importing a module into the same session. The first command imports the BitsTransfer module. The second command imports the module again, this time using the Prefix parameter. The second command also includes the Force parameter, which removes the module and then imports it again. Without this parameter, the session would include two copies of each BitsTransfer cmdlet, one with the standard name and one with the prefixed name.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-date Saturday, September 12, 2009 6:47:04 PM C:\PS> import-module TestModule C:\PS> get-date 09255 C:\PS> get-command get-date | format-table -property commandtype, name, pssnapin, module -auto CommandType Name pssnapin Module ----------- ---- -------- ------ Function Get-Date TestModule Cmdlet Get-Date Microsoft.PowerShell.Utility C:\PS> Microsoft.PowerShell.Utility\get-date Saturday, September 12, 2009 6:33:23 PM </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to run commands that have been hidden by imported commands. The first command run the Get-Date cmdlet that comes with Windows PowerShell. It returns a DateTime object with the current date. The second command imports the TestModule module. This module includes a function named Get-Date that returns the Julian date. The third command runs the Get-Date command again. Because functions take precedence over cmdlets, the Get-Date function from the TestModule module ran, instead of the Get-Date cmdlet. The fourth command shows that there are two Get-Date commands in the session, a function from the TestModule module and a cmdlet from the Microsoft.PowerShell.Utility snap-in. The fifth command runs the hidden cmdlet by qualifying the command name with the snap-in name. For more information about command precedence in Windows PowerShell, see about_command_precedence.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141553</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Export-ModuleMember</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Invoke-Command </command:name> <maml:description> <maml:para>Runs commands on local and remote computers.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Invoke</command:verb> <command:noun>Command</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Invoke-Command cmdlet runs commands on a local or remote computer and returns all output from the commands, including errors. With a single Invoke-Command command, you can run commands on multiple computers. To run a single command on a remote computer, use the ComputerName parameter. To run a series of related commands that share data, create a PSSession (a persistent connection) on the remote computer, and then use the Session parameter of Invoke-Command to run the command in the PSSession. You can also use Invoke-Command on a local computer to evaluate or run a string in a script block as a command. Windows PowerShell converts the script block to a command and runs the command immediately in the current scope, instead of just echoing the string at the command line. Before using Invoke-Command to run commands on a remote computer, read about_Remote.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run. Enclose the commands in curly braces ( { } ) to create a script block. This parameter is required. By default, any variables in the command are evaluated on the remote computer. To include local variables in the command, use the ArgumentList parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Specifies the computers on which the command runs. The default is the local computer. When you use the ComputerName parameter, Windows PowerShell creates a temporary connection that is used only to run the specified command and is then closed. If you need a persistent connection, use the Session parameter. Type the NETBIOS name, IP address, or fully-qualified domain name of one or more computers in a comma-separated list. To specify the local computer, type the computer name, "localhost", or a dot (.). To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: On Windows Vista, and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must open Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can only be mapped to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem commands in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a variable that contains a PSCredential object, such as one generated by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. To configure the listener, type the following two commands at the Windows PowerShell prompt: remove-item -path wsman:\Localhost\listener\listener* -recurse new-item -path wsman:\Localhost\listener -Transport http -Address * -port <port-number> Do not use the Port parameter unless you must. The Port set in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see the help topic for the New-PSSessionOption cmdlet. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS, instead of HTTP. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script on one or more remote computers. Enter the path and file name of the script, or pipe a script path to Invoke-Command. The script must reside on the local computer or in a directory that the local computer can access. Use the ArgumentList parameter to specify the values of parameters in the script. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block, transmits the script block to the remote computer, and runs it on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Specifies the computers on which the command runs. The default is the local computer. When you use the ComputerName parameter, Windows PowerShell creates a temporary connection that is used only to run the specified command and is then closed. If you need a persistent connection, use the Session parameter. Type the NETBIOS name, IP address, or fully-qualified domain name of one or more computers in a comma-separated list. To specify the local computer, type the computer name, "localhost", or a dot (.). To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: On Windows Vista, and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must open Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a variable that contains a PSCredential object, such as one generated by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. To configure the listener, type the following two commands at the Windows PowerShell prompt: remove-item -path wsman:\Localhost\listener\listener* -recurse new-item -path wsman:\Localhost\listener -Transport http -Address * -port <port-number> Do not use the Port parameter unless you must. The Port set in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see the help topic for the New-PSSessionOption cmdlet. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS, instead of HTTP. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script on one or more remote computers. Enter the path and file name of the script, or pipe a script path to Invoke-Command. The script must reside on the local computer or in a directory that the local computer can access. Use the ArgumentList parameter to specify the values of parameters in the script. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block, transmits the script block to the remote computer, and runs it on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Runs the command in the specified Windows PowerShell sessions (PSSessions). Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. When you create a PSSession, Windows PowerShell establishes a persistent connection to the remote computer. Use a PSSession to run a series of related commands that share data. To run a single command or a series of unrelated commands, use the ComputerName parameter. To create a PSSession, use the New-PSSession cmdlet. For more information, see about_PSSessions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script on one or more remote computers. Enter the path and file name of the script, or pipe a script path to Invoke-Command. The script must reside on the local computer or in a directory that the local computer can access. Use the ArgumentList parameter to specify the values of parameters in the script. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block, transmits the script block to the remote computer, and runs it on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified. The format of this string is: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Uri[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate URI. When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter and the help topic for the New-PSSessionOption cmdlet. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a variable that contains a PSCredential object, such as one generated by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see the help topic for the New-PSSessionOption cmdlet. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run. Enclose the commands in curly braces ( { } ) to create a script block. This parameter is required. By default, any variables in the command are evaluated on the remote computer. To include local variables in the command, use the ArgumentList parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run. Enclose the commands in curly braces ( { } ) to create a script block. This parameter is required. By default, any variables in the command are evaluated on the remote computer. To include local variables in the command, use the ArgumentList parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Runs the command in the specified Windows PowerShell sessions (PSSessions). Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. When you create a PSSession, Windows PowerShell establishes a persistent connection to the remote computer. Use a PSSession to run a series of related commands that share data. To run a single command or a series of unrelated commands, use the ComputerName parameter. To create a PSSession, use the New-PSSession cmdlet. For more information, see about_PSSessions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Command</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run. Enclose the commands in curly braces ( { } ) to create a script block. This parameter is required. By default, any variables in the command are evaluated on the remote computer. To include local variables in the command, use the ArgumentList parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified. The format of this string is: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Uri[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate URI. When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter and the help topic for the New-PSSessionOption cmdlet. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can only be mapped to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem commands in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a variable that contains a PSCredential object, such as one generated by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see the help topic for the New-PSSessionOption cmdlet. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate URI. When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter and the help topic for the New-PSSessionOption cmdlet. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>WSMAN</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Supplies the values of local variables in the command. The variables in the command are replaced by these values before the command is run on the remote computer. Enter the values in a comma-separated list. Values are associated with variables in the order that they are listed. The alias for ArgumentList is "Args". The values in ArgumentList can be actual values, such as "1024", or they can be references to local variables, such as "$max". To use local variables in a command, use the following command format: {param($<name1>[, $<name2>]...) <command-with-local-variables>} -ArgumentList <value | $local-variable> The "param" keyword lists the local variables that are used in the command. The ArgumentList parameter supplies the values of the variables, in the order that they are listed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsJob</maml:name> <maml:description> <maml:para>Runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete. When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use Receive-Job. The AsJob parameter is similar to using Invoke-Command to run a Start-Job command remotely. However, with AsJob, the job is created on the local computer, even though the job runs on a remote computer, and the results of the remote job are automatically returned to the local computer. For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AuthenticationMechanism</command:parameterValue> <dev:type> <maml:name>AuthenticationMechanism</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Default</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can only be mapped to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem commands in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Specifies the computers on which the command runs. The default is the local computer. When you use the ComputerName parameter, Windows PowerShell creates a temporary connection that is used only to run the specified command and is then closed. If you need a persistent connection, use the Session parameter. Type the NETBIOS name, IP address, or fully-qualified domain name of one or more computers in a comma-separated list. To specify the local computer, type the computer name, "localhost", or a dot (.). To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: On Windows Vista, and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must open Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>http://Schemas.Microsoft.com/PowerShell/Microsoft.PowerShell</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified. The format of this string is: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Uri[]</command:parameterValue> <dev:type> <maml:name>Uri[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>http://localhost:80/wsman</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a variable that contains a PSCredential object, such as one generated by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script on one or more remote computers. Enter the path and file name of the script, or pipe a script path to Invoke-Command. The script must reside on the local computer or in a directory that the local computer can access. Use the ArgumentList parameter to specify the values of parameters in the script. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block, transmits the script block to the remote computer, and runs it on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>HideComputerName</maml:name> <maml:description> <maml:para>Omits the computer name of each object from the output display. By default, the name of the computer that generated the object appears in the display. This parameter affects only the output display. It does not change the object.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects or type a command or expression that gets the objects. When using InputObject, use the $input automatic variable in the value of the ScriptBlock parameter to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> <dev:type> <maml:name>psobject</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a friendly name for the background job. By default, jobs are named "Job<n>", where <n> is an ordinal number. This parameter is valid only with the AsJob parameter. If you use the JobName parameter in a command, the command is run as a job, and Invoke-Command returns a job object, even if you do not include the AsJob parameter in the command. For more information about Windows PowerShell background jobs, see about_Jobs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Job<n></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. To configure the listener, type the following two commands at the Windows PowerShell prompt: remove-item -path wsman:\Localhost\listener\listener* -recurse new-item -path wsman:\Localhost\listener -Transport http -Address * -port <port-number> Do not use the Port parameter unless you must. The Port set in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run. Enclose the commands in curly braces ( { } ) to create a script block. This parameter is required. By default, any variables in the command are evaluated on the remote computer. To include local variables in the command, use the ArgumentList parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Runs the command in the specified Windows PowerShell sessions (PSSessions). Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. When you create a PSSession, Windows PowerShell establishes a persistent connection to the remote computer. Use a PSSession to run a series of related commands that share data. To run a single command or a series of unrelated commands, use the ComputerName parameter. To create a PSSession, use the New-PSSession cmdlet. For more information, see about_PSSessions. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> <dev:type> <maml:name>PSSession[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see the help topic for the New-PSSessionOption cmdlet. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> <dev:type> <maml:name>PSSessionOption</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>32</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS, instead of HTTP. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.ScriptBlock</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a command in a script block to Invoke-Command. Use the $input automatic variable to represent the input objects in the command. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSRemotingJob or the output of the invoked command </maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> When you use the AsJob parameter, Invoke-Command returns a job object. Otherwise, it returns the output of the invoked command (the value of the ScriptBlock parameter). </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> -- On Windows Vista, and later versions of Windows, to use the ComputerName parameter of Invoke-Command to run a command on the local computer, you must open Windows PowerShell with the "Run as administrator" option. -- When you run commands on multiple computers, Windows PowerShell connects to the computers in the order in which they appear in the list. However, the command output is displayed in the order that it is received from the remote computers, which might be different. -- Errors that result from the command that Invoke-Command runs are included in the command results. Errors that would be terminating errors in a local command are treated as non-terminating errors in a remote command. This strategy ensures that terminating errors on one computer do not terminate the command on all computers on which it is run. This practice is used even when a remote command is run on a single computer. -- If the remote computer is not in a domain that the local computer trusts, the computer might not be able to authenticate the user's credentials. To add the remote computer to the list of "trusted hosts" in WS-Management, use the following command in the WSMAN provider, where <Remote-Computer-Name> is the name of the remote computer: set-item -path wsman:\Localhost\Client\TrustedHosts -value <Remote-Computer-Name>. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -filepath c:\scripts\test.ps1 -computerName Server01 Disks: C:, D:, E: Status: Warning, Normal, Normal </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the Test.ps1 script on the Server01 computer. The command uses the FilePath parameter to specify a script that is located on the local computer. The script runs on the remote computer and the results are returned to the local computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -computername server01 -credential domain01\user01 -scriptblock {get-culture} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs a Get-Culture command on the Server01 remote computer. It uses the ComputerName parameter to specify the computer name and the Credential parameter to run the command in the security context of "Domain01\User01," a user with permission to run commands. It uses the ScriptBlock parameter to specify the command to be run on the remote computer. In response, Windows PowerShell displays a dialog box that requests the password and an authentication method for the User01 account. It then runs the command on the Server01 computer and returns the result.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername server02 -credential domain01\user01 C:\PS> invoke-command -session $s -scriptblock {get-culture} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example runs the same "Get-Culture" command in a session (a persistent connection) on the Server02 remote computer. Typically, you create a session only when you are running a series of commands on the remote computer. The first command uses the New-PSSession cmdlet to create a session on the Server02 remote computer. Then, it saves the session in the $s variable. The second command uses the Invoke-Command cmdlet to run the Get-Culture command on Server02. It uses the Session parameter to specify the session saved in the $s variable. In response, Windows PowerShell runs the command in the session on the Server02 computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -computername Server02 -scriptblock {$p = get-process powershell} C:\PS> invoke-command -computername Server02 -scriptblock {$p.virtualmemorysize} C:\PS> C:\PS> $s = new-pssession -computername Server02 C:\PS> invoke-command -session $s -scriptblock {$p = get-process powershell} C:\PS> invoke-command -session $s -scriptblock {$p.virtualmemorysize} 17930240 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example compares the effects of using ComputerName and Session parameters of Invoke-Command. It shows how to use a session to run a series of commands that share the same data. The first two commands use the ComputerName parameter of Invoke-Command to run commands on the Server02 remote computer. The first command uses the Get-Process command to get the PowerShell process on the remote computer and to save it in the $p variable. The second command gets the value of the VirtualMemorySize property of the PowerShell process. The first command succeeds. But, the second command fails because when you use the ComputerName parameter, Windows PowerShell creates a connection just to run the command. Then, it closes the connection when the command is complete. The $p variable was created in one connection, but it does not exist in the connection created for the second command. The problem is solved by creating a session (a persistent connection) on the remote computer and by running both of the related commands in the same session. The third command uses the New-PSSession cmdlet to create a session on the Server02 computer. Then it saves the session in the $s variable. The fourth and fifth commands repeat the series of commands used in the first set, but in this case, the Invoke-Command command uses the Session parameter to run both of the commands in the same session. In this case, because both commands run in the same session, the commands succeed, and the $p value remains active in the $s session for later use.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $command = { get-eventlog -log "windows powershell" | where {$_.message -like "*certificate*"} } C:\PS> invoke-command -computername S1, S2 -scriptblock $command </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to enter a command that is saved in a local variable. When the entire command is saved in a local variable, you can specify the variable as the value of the ScriptBlock parameter. You do not have to use the "param" keyword or the ArgumentList variable to submit the value of the local variable. The first command saves a Get-Eventlog command in the $command variable. The command is formatted as a script block. The second command uses the Invoke-Command cmdlet to run the command in $command on the S1 and S2 remote computers.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -computername server01, server02, TST-0143, localhost -configurationname MySession.PowerShell -scriptblock {get-eventlog "windows powershell"} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example demonstrates how to use the Invoke-Command cmdlet to run a single command on multiple computers. The command uses the ComputerName parameter to specify the computers. The computer names are presented in a comma-separated list. The list of computers includes the "localhost" value, which represents the local computer. The command uses the ConfigurationName parameter to specify an alternate session configuration for Windows PowerShell and the ScriptBlock parameter to specify the command. In this example, the command in the script block gets the events in the Windows PowerShell event log on each remote computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $version = invoke-command -computername (get-content machines.txt) -scriptblock {(get-host).version} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the version of the Windows PowerShell host running on 200 remote computers. Because only one command is run, it is not necessary to create persistent connections (sessions) to each of the computers. Instead, the command uses the ComputerName parameter to indicate the computers. The command uses the Invoke-Command cmdlet to run a Get-Host command. It uses dot notation to get the Version property of the Windows PowerShell host. To specify the computers, it uses the Get-Content cmdlet to get the contents of the Machine.txt file, a file of computer names. These commands run synchronously (one at a time). When the commands complete, the output of the commands from all of the computers is saved in the $version variable. The output includes the name of the computer from which the data originated.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01, Server02 C:\PS> invoke-command -session $s -scriptblock {get-eventlog system} -AsJob Id Name State HasMoreData Location Command --- ---- ----- ----- ----------- -------- ------- 1 Job1 Running True Server01,Server02 get-eventlog system C:\PS> $j = Get-Job C:\PS> $j | format-list -property * HasMoreData : True StatusMessage : Location : Server01,Server02 Command : get-eventlog system JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca Id : 1 Name : Job1 ChildJobs : {Job2, Job3} Output : {} Error : {} Progress : {} Verbose : {} Debug : {} Warning : {} StateChanged : C:\PS> $results = $j | Receive-Job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands run a background job on two remote computers. Because the Invoke-Command command uses the AsJob parameter, the commands run on the remote computers, but the job actually resides on the local computer and the results are transmitted to the local computer. The first command uses the New-PSSession cmdlet to create sessions on the Server01 and Server02 remote computers. The second command uses the Invoke-Command cmdlet to run a background job in each of the sessions. The command uses the AsJob parameter to run the command as a background job. This command returns a job object that contains two child job objects, one for each of the jobs run on the two remote computers. The third command uses a Get-Job command to save the job object in the $j variable. The fourth command uses a pipeline operator (|) to send the value of the $j variable to the Format-List cmdlet, which displays all properties of the job object in a list. The fifth command gets the results of the jobs. It pipes the job object in $j to the Receive-Job cmdlet and stores the results in the $results variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $MWFO-LOg = Microsoft-Windows-Forwarding/Operational C:\PS> invoke-command -computername server01 -scriptblock {param($log, $num) get-eventlog -logname $log -newest $num} -ArgumentList $MWFO-log, 10 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to include the values of local variables in a command run on a remote computer. The first command saves the name of the Microsoft-Windows-Forwarding/Operational event log in the $MWFO-Log variable. The second command uses the Invoke-Command cmdlet to run a Get-EventLog command on the Server01 remote computer that gets the 10 newest events from the Microsoft-Windows-Forwarding/Operational event log on Server01. This command uses the "param" keyword to create two variables, $log and $num, that are used as placeholders in the Get-EventLog command. These placeholders have arbitrary names that do not need to match the names of the local variables that supply their values. The values of the ArgumentList parameter demonstrate the two different ways to specify values in the argument list. The value of the $log placeholder is the $MFWO-Log variable, which is defined in the first command. The value of the $num variable is 10. Before the command is sent to the remote computer, the variables are replaced with the specified values. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 10 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -computername S1, S2 -scriptblock {get-process powershell} PSComputerName Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName -------------- ------- ------ ----- ----- ----- ------ -- ----------- S1 575 15 45100 40988 200 4.68 1392 powershell S2 777 14 35100 30988 150 3.68 67 powershell C:\PS> invoke-command -computername S1, S2 -scriptblock {get-process powershell} -HideComputerName Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 575 15 45100 40988 200 4.68 1392 powershell 777 14 35100 30988 150 3.68 67 powershell </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows the effect of using the HideComputerName parameter of Invoke-Command. The first two commands use the Invoke-Command cmdlet to run a Get-Process command for the PowerShell process. The output of the first command includes the PsComputerName property, which contains the name of the computer on which the command ran. The output of the second command, which uses the HideComputerName parameter, does not include the PsComputerName column. Using the HideComputerName parameter does not change the object. You can still use the Format cmdlets to display the PsComputerName property of any of the affected objects.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 11 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-command -comp (get-content servers.txt) -filepath c:\scripts\sample.ps1 -argumentlist Process, Service </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example uses the Invoke-Command cmdlet to run the Sample.ps1 script on all of the computers listed in the Servers.txt file. The command uses the FilePath parameter to specify the script file. This command allows you to run the script on the remote computers, even if the script file is not accessible to the remote computers. When you submit the command, the content of the Sample.ps1 file is copied into a script block and the script block is run on each of the remote computers. This procedure is equivalent to using the ScriptBlock parameter to submit the contents of the script.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 12 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $LiveCred = Get-Credential C:\PS> Invoke-Command -ConfigurationName Microsoft.Exchange ` -ConnectionUri https://ps.exchangelabs.com/powershell ` -Credential $LiveCred -Authentication Basic ` -scriptblock {Invoke-Command {Set-Mailbox dan -DisplayName "Dan Park"} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to run a command on a remote computer that is identified by a URI (Internet address). This particular example runs a Set-Mailbox command on a remote Exchange server. The backtick (`) in the command is the Windows PowerShell continuation character. The first command uses the Get-Credential cmdlet to store Windows Live ID credentials in the $LiveCred variab the credentials dialog box appears, enter Windows Live ID credentials. The second command uses the Invoke-Command cmdlet to run a Set-Mailbox command. The command uses the ConfigurationName parameter to specify that the command should run in a session that uses the Microsoft.Exchange session configuration. The ConnectionURI parameter specifies the URL of the Exchange server endpoint. The credential parameter specifies tle. Whenhe Windows Live credentials stored in the $LiveCred variable. The AuthenticationMechanism parameter specifies the use of basic authentication. The ScriptBlock parameter specifies a script block that contains the command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 13 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $max = New-PSSessionOption -MaximumRedirection 1 C:\PS> Invoke-Command -ConnectionUri https://ps.exchangelabs.com/powershell ` -scriptblock {Invoke-Command {Get-Mailbox dan} ` -AllowRedirection -SessionOption $max </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command shows how to use the AllowRedirection and SessionOption parameters to manage URI redirection in a remote command. The first command uses the New-PSSessionOption cmdlet to create a PSSessionOpption object that it saves in the $max variable. The command uses the MaximumRedirection parameter to set the MaximumConnectionRedirectionCount property of the PSSessionOption object to 1. The second command uses the Invoke-Command cmdlet to run a Get-Mailbox command on a remote server running Microsoft Exchange Server. The command uses the AllowRedirection parameter to provide explicit permission to redirect the connection to an alternate endpoint. It also uses the SessionOption parameter to specify the session object in the $max variable. As a result, if the remote computer specified by the ConnectionURI parameter returns a redirection message, Windows PowerShell will redirect the connection, but if the new destination returns another redirection message, the redirection count value of 1 is exceeded, and Invoke-Command returns a non-terminating error.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 14 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $so = New-PSSessionOption -SkipCACheck PS C:\> invoke-command $s { get-hotfix } -SessionOption $so -credential server01\user01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to create and use a SessionOption parameter. The first command uses the New-PSSessionOption cmdlet to create a session option. It saves the resulting SessionOption object in the $so parameter. The second command uses the Invoke-Command cmdlet to run a Get-Hotfix command remotely. The value of the SessionOption parameter is the SessionOption object in the $so variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 15 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enable-wsmanCredSSP -delegate server02 C:\PS> connect-wsman Server02 C:\PS> set-item wsman:\server02*\service\auth\credSSP -value $true C:\PS> $s = new-pssession server02 C:\PS> invoke-command -session $s -script {get-item \\Net03\Scripts\LogFiles.ps1} -authentication credssp -credential domain01\admin01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to access a network share from within a remote session. The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the service settings on the remote computer. To run the commands in this example, you must be a member of the Administrators group on the local computer and the remote computer. The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer to the Server02 remote computer. This configures the CredSSP client setting on the local computer. The second command uses the Connect-WSman cmdlet to connect to the Server02 computer. This action adds a node for the Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management settings on the Server02 computer. The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Server02 computer to True. This action enables CredSSP in the service settings on the remote computer. The fourth command uses the New-PSSession cmdlet to create a PSSession on the Server02 computer. It saves the PSSession in the $s variable. The fifth command uses the Invoke-Command cmdlet to run a Get-Item command in the session in $s that gets a script from the Net03\Scripts network share. The command uses the Credential parameter and it uses the Authentication parameter with a value of CredSSP.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135225</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exit-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Invoke-History </command:name> <maml:description> <maml:para>Runs commands from the session history.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Invoke</command:verb> <command:noun>History</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Invoke-History cmdlet runs commands from the session history. You can pass objects representing the commands from Get-History to Invoke-History, or you can identify commands in the current history by using their ID number. To find the identification number of a command, use Get-History.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Invoke-History</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Identifies a command in the history. You can type the ID number of the command or the first few characters of the command. If you type characters, Invoke-History matches the most recent commands first. If you omit this parameter, Invoke-History runs the last (most recent) command. The parameter name ("id") is optional. To find the ID number of a command, use Get-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Identifies a command in the history. You can type the ID number of the command or the first few characters of the command. If you type characters, Invoke-History matches the most recent commands first. If you omit this parameter, Invoke-History runs the last (most recent) command. The parameter name ("id") is optional. To find the ID number of a command, use Get-History.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Invoke-History does not generate any output, but output might be generated by the commands that Invoke-History runs. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> The session history is a list of the commands entered during the session along with the ID. The session history represents the order of execution, the status, and the start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it. For more information about the session history, see about_History. You can also refer to Invoke-History by its built-in aliases, "r" and "ihy". For more information, see about_Aliases. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the last (most recent) command in the session history. You can abbreviate this command as "r" (think "repeat" or "rerun"), the alias for Invoke-History.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-history -id 132 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the command in the session history with ID 132. Because the name of the Id parameter is optional, you can abbreviate this command as "Invoke-History 132", "ihy 132", or "r 132".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-history get-pr </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the most recent Get-Process command in the session history. When you type characters for the Id parameter, Invoke-History runs the first command that it finds that matches the pattern, beginning with the most recent commands. This command uses the ID parameter, but it omits the optional parameter name.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> invoke-history (16..24), 27 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs commands 16 through 24 and 27. You can list multiple IDs and ID ranges separated by commas.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-history -id 255 -count 7 | invoke-history </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the 7 commands in the history that end with command 255 (typically 249 through 255). It uses the Get-History cmdlet to retrieve the commands. The pipeline operator (|) passes the commands to Invoke-History, which executes them.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113344</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-History</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Clear-History</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> New-Module </command:name> <maml:description> <maml:para>Creates a new dynamic module that exists only in memory.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>New</command:verb> <command:noun>Module</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The New-Module cmdlet creates a dynamic module from a script block. The members of the dynamic module, such as functions and variables, are immediately available in the session and remain available until you close the session. Like static modules, by default, the cmdlets and functions in a dynamic module are exported and the variables and aliases are not. However, you can use the Export-ModuleMember cmdlet and the parameters of New-Module to override the defaults. Dynamic modules exist only in memory, not on disk. Like all modules, the members of dynamic modules run in a private module scope that is a child of the global scope. Get-Module cannot get a dynamic module, but Get-Command can get the exported members. To make a dynamic module available to Get-Module, pipe a New-Module command to Import-Module, or pipe the module object that New-Module returns to Import-Module. This action adds the dynamic module to the Get-Module list, but it does not save the module to disk or make it persistent.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>New-Module</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the new module. You can also pipe a module name to New-Module. The default value is an autogenerated name that begins with "__DynamicModule_" and is followed by a GUID that specifies the path to the dynamic module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the contents of the dynamic module. Enclose the contents in braces ( { } ) to create a script block. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to the script block. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the module members. When you use the AsCustomObject parameter, New-Module creates the dynamic module, imports the module members into the current session, and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. If the module has multiple members with the same name, such as a function and a variable that are both named "A," only one member with each name is accessible from the custom object. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Exports only the specified cmdlets from the module into the current session. Enter a comma-separated list of cmdlets. Wildcard characters are permitted. By default, all cmdlets in the module are exported. You cannot define cmdlets in a script block, but a dynamic module can include cmdlets if it imports the cmdlets from a binary module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Exports only the specified functions from the module into the current session. Enter a comma-separated list of functions. Wildcard characters are permitted. By default, all functions defined in a module are exported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ReturnResult</maml:name> <maml:description> <maml:para>Runs the script block and returns the script block results instead of returning a module object.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-Module</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the contents of the dynamic module. Enclose the contents in braces ( { } ) to create a script block. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to the script block. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the module members. When you use the AsCustomObject parameter, New-Module creates the dynamic module, imports the module members into the current session, and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. If the module has multiple members with the same name, such as a function and a variable that are both named "A," only one member with each name is accessible from the custom object. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Exports only the specified cmdlets from the module into the current session. Enter a comma-separated list of cmdlets. Wildcard characters are permitted. By default, all cmdlets in the module are exported. You cannot define cmdlets in a script block, but a dynamic module can include cmdlets if it imports the cmdlets from a binary module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Exports only the specified functions from the module into the current session. Enter a comma-separated list of functions. Wildcard characters are permitted. By default, all functions defined in a module are exported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ReturnResult</maml:name> <maml:description> <maml:para>Runs the script block and returns the script block results instead of returning a module object.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies arguments (parameter values) that are passed to the script block. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AsCustomObject</maml:name> <maml:description> <maml:para>Returns a custom object with members that represent the module members. When you use the AsCustomObject parameter, New-Module creates the dynamic module, imports the module members into the current session, and then returns a PSCustomObject object instead of a PSModuleInfo object. You can save the custom object in a variable and use dot notation to invoke the members. If the module has multiple members with the same name, such as a function and a variable that are both named "A," only one member with each name is accessible from the custom object. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Cmdlet</maml:name> <maml:description> <maml:para>Exports only the specified cmdlets from the module into the current session. Enter a comma-separated list of cmdlets. Wildcard characters are permitted. By default, all cmdlets in the module are exported. You cannot define cmdlets in a script block, but a dynamic module can include cmdlets if it imports the cmdlets from a binary module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>Function</maml:name> <maml:description> <maml:para>Exports only the specified functions from the module into the current session. Enter a comma-separated list of functions. Wildcard characters are permitted. By default, all functions defined in a module are exported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the new module. You can also pipe a module name to New-Module. The default value is an autogenerated name that begins with "__DynamicModule_" and is followed by a GUID that specifies the path to the dynamic module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>"__DynamicModule_" + GUID</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ReturnResult</maml:name> <maml:description> <maml:para>Runs the script block and returns the script block results instead of returning a module object.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the contents of the dynamic module. Enclose the contents in braces ( { } ) to create a script block. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a module name string to New-Module. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSModuleInfo, System.Management.Automation.PSCustomObject, or None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> By default, New-Module generates a PSModuleInfo object. If you use the AsCustomObject parameter, it generates a PSCustomObject object. If you use the ReturnResult parameter, it returns the result of evaluating the script block in the dynamic module. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can also refer to New-Module by its alias, "nmo". For more information, see about_Aliases. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-module -scriptblock {function Hello {"Hello!"}} Name : __DynamicModule_2ceb1d0a-990f-45e4-9fe4-89f0f6ead0e5 Path : 2ceb1d0a-990f-45e4-9fe4-89f0f6ead0e5 Description : Guid : 00000000-0000-0000-0000-000000000000 Version : 0.0 ModuleBase : ModuleType : Script PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {} ExportedFunctions : {[Hello, Hello]} ExportedVariables : {} NestedModules : {} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new dynamic module with a function called "Hello". The command returns a module object that represents the new dynamic module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-module -scriptblock {function Hello {"Hello!"}} Name : __DynamicModule_2ceb1d0a-990f-45e4-9fe4-89f0f6ead0e5 Path : 2ceb1d0a-990f-45e4-9fe4-89f0f6ead0e5 Description : Guid : 00000000-0000-0000-0000-000000000000 Version : 0.0 ModuleBase : ModuleType : Script PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {} ExportedFunctions : {[Hello, Hello]} ExportedVariables : {} NestedModules : {} C:\PS> get-module C:\PS> C:\PS> get-command Hello CommandType Name Definition ----------- ---- ---------- Function Hello "Hello!" </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example demonstrates that dynamic modules are not returned by the Get-Module cmdlet, but the members that they export are returned by the Get-Command cmdlet.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> New-Module -scriptblock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($name) { "Hello, $name" }; Export-ModuleMember -function SayHello -Variable SayHelloHelp} C:\PS> $SayHelloHelp Type 'SayHello', a space, and a name. C:\PS> SayHello Jeffrey Hello, Jeffrey </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Export-ModuleMember cmdlet to export a variable into the current session. Without the Export-ModuleMember command, only the function is exported. The output shows that both the variable and the function were exported into the session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-module -scriptblock {function Hello {"Hello!"}} -name GreetingModule | import-module C:\PS> get-module Name : GreetingModule Path : d54dfdac-4531-4db2-9dec-0b4b9c57a1e5 Description : Guid : 00000000-0000-0000-0000-000000000000 Version : 0.0 ModuleBase : ModuleType : Script PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {} ExportedFunctions : {[Hello, Hello]} ExportedVariables : {} NestedModules : {} C:\PS> get-command hello CommandType Name Definition ----------- ---- ---------- Function Hello "Hello!" </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command demonstrates that you can make a dynamic module available to the Get-Module cmdlet by piping the dynamic module to the Import-Module cmdlet. The first command uses a pipeline operator (|) to send the module object that New-Module generates to the Import-Module cmdlet. The command uses the Name parameter of New-Module to assign a friendly name to the module. Because Import-Module does not return any objects by default, there is no output from this command. The second command uses the Get-Module cmdlet to get the modules in the session. The result shows that Get-Module can get the new dynamic module. The third command uses the Get-Command cmdlet to get the Hello function that the dynamic module exports.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $m = new-module -scriptblock {function Hello ($name) {"Hello, $name"}; function Goodbye ($name) {"Goodbye, $name"}} -AsCustomObject C:\PS> $m C:\PS> $m | get-member TypeName: System.Management.Automation.PSCustomObject Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Goodbye ScriptMethod System.Object Goodbye(); Hello ScriptMethod System.Object Hello(); PS C:\ps-test> $m.goodbye("Jane") Goodbye, Jane PS C:\ps-test> $m.hello("Manoj") Hello, Manoj PS C:\ps-test> goodbye Jane Goodbye, Jane PS C:\ps-test> hello Manoj Hello, Manoj </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the AsCustomObject parameter of New-Module to generate a custom object with script methods that represent the exported functions. The first command uses the New-Module cmdlet to generate a dynamic module with two functions, Hello and Goodbye. The command uses the AsCustomObject parameter to generate a custom object instead of the PSModuleInfo object that New-Module generates by default. The command saves the custom object in the $m variable. The second command attempts to display the value of the $m variable. No content appears. The third command uses a pipeline operator (|) to send the custom object to the Get-Member cmdlet, which displays the properties and methods of the custom object. The output shows that the object has script methods that represent the Hello and Goodbye functions. The fourth and fifth commands use the script method format to call the Hello and Goodbye functions. The sixth and seventh commands call the functions by specifying the function name and parameter value.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-module -scriptblock {function SayHello {"Hello, World!"}; SayHello} -returnResult Hello, World! </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the ReturnResult parameter to request the results of running the script block instead of requesting a module object. The script block in the new module defines the SayHello function and then calls the function. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141554</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Export-ModuleMember</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> New-ModuleManifest </command:name> <maml:description> <maml:para>Creates a new module manifest.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>New</command:verb> <command:noun>ModuleManifest</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The New-ModuleManifest cmdlet creates a new module manifest (.psd1) file, populates its values, and saves the manifest file in the specified path. Module authors can use this cmdlet to create a manifest for their module. A module manifest is a .psd1 file that contains a hash table. The keys and values in the hash table describe the contents and attributes of the module, define the prerequisites, and determine how the components are processed. Manifests are not required for a module. New-ModuleManifest creates a manifest that includes all of the commonly used manifest keys, so you can use the default output as a manifest template. To add or change values, or to add module keys that this cmdlet does not add, open the resulting file in a text editor. Each parameter of this cmdlet (except for Path and PassThru) creates a module manifest key and its value. In a module manifest, only the ModuleVersion key is required. However, several other parameters of this cmdlet are mandatory. As a result, you can type a "New-ModuleManifest" command without parameters and the cmdlet will prompt you for values for other commonly used keys. To leave the value empty, press ENTER. For a complete description of the format, effects, and requirements of a module manifest, see "How to Write a Module Manifest" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143613. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>New-ModuleManifest</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path and file name of the new module manifest. Enter a path and file name with a .psd1 file name extension, such as "$pshome\Modules\MyModule\MyModule.psd1". This parameter is required. If you specify the path to an existing file, New-ModuleManifest replaces the file without warning unless the file has the read-only attribute. The manifest should be located in the module's directory, and the manifest file name should be the same as the module directory name, but with a .psd1 file name extension. Note: You cannot use variables, such as $pshome or $home, in response to a prompt for a Path parameter value. To use a variable, include the Path parameter in the command. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Author</maml:name> <maml:description> <maml:para>Specifies the module author. This parameter is required by the cmdlet, but the Author key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates an Author key with the name of the current user.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CompanyName</maml:name> <maml:description> <maml:para>Identifies the company or vendor who created the module. This parameter is required by the cmdlet, but the CompanyName key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a CompanyName key with a value of "Unknown".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Copyright</maml:name> <maml:description> <maml:para>Specifies a copyright statement for the module. This parameter is required by the cmdlet, but the Copyright key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a Copyright key with a value of "(c) <year> <username>. All rights reserved." where <year> is the current year and <username> is the value of the Author key (if one is specified) or the name of the current user.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Description</maml:name> <maml:description> <maml:para>Describes the contents of the module. This parameter is required by the cmdlet, but the Description key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a Description key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>FileList</maml:name> <maml:description> <maml:para>Specifies all items that are included in the module. This key is designed to act as a module inventory. These files are not automatically exported with the module. This parameter is required by the cmdlet, but the FileList key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a FileList key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>FormatsToProcess</maml:name> <maml:description> <maml:para>Specifies the formatting files (.ps1xml) that run when the module is imported. When you import a module, Windows PowerShell runs the Update-FormatData cmdlet with the specified files. Because formatting files are not scoped, they affect all session states in the session. This parameter is required by the cmdlet, but the FormatsToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a FormatsToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleToProcess</maml:name> <maml:description> <maml:para>Specifies the primary or "root" file of the module. When the module is imported, the members that are exported from the root module file are imported into the caller's session state. Enter the file name of one script module (.psm1) or binary module (.dll). If a module has a manifest file and no root file has been designated in the ModuleToProcess key, the manifest becomes the primary file for the module, and the module becomes a "manifest module" (ModuleType = Manifest). To export members from .psm1 or .dll files in a module that has a manifest, the names of those files must be specified in the values of the ModuleToProcess or NestedModules keys in the manifest. Otherwise, their members are not exported. This parameter is required by the cmdlet, but the ModuleToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a ModuleToProcess key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>NestedModules</maml:name> <maml:description> <maml:para>Specifies script modules (.psm1) and binary modules (.dll) that are imported into the module's session state. The files in the NestedModules key run in the order in which they are listed in the value. Typically, nested modules contain commands that the root module needs for its internal processing. By default, the commands in nested modules are exported from the module's session state into the caller's session state, but the root module can restrict the commands that it exports (for example, by using an Export-Module command). Nested modules in the module session state are available to the root module, but they are not returned by a Get-Module command in the caller's session state. Scripts (.ps1) that are listed in the NestedModules key are run in the module's session state, not in the caller's session state. To run a script in the caller's session state, list the script file name in the value of the ScriptsToProcess key in the manifest. This parameter is required by the cmdlet, but the NestedModules key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a NestedModules key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>RequiredAssemblies</maml:name> <maml:description> <maml:para>Specifies the assembly (.dll) files that the module requires. Windows PowerShell loads the specified assemblies before updating types or formats, importing nested modules, or importing the module file that is specified in the value of the ModuleToProcess key. Use this parameter to list all the assemblies that the module requires, including assemblies that must be loaded to update any formatting or type files that are listed in the FormatsToProcess or TypesToProcess keys, even if those assemblies are also listed as binary modules in the NestedModules key. This parameter is required by the cmdlet, but the RequiredAssemblies key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a RequiredAssemblies key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>TypesToProcess</maml:name> <maml:description> <maml:para>Specifies the type files (.ps1xml) that run when the module is imported. When you import the module, Windows PowerShell runs the Update-TypeData cmdlet with the specified files. Because type files are not scoped, they affect all session states in the session. This parameter is required by the cmdlet, but the TypesToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a TypesToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>AliasesToExport</maml:name> <maml:description> <maml:para>Specifies the aliases that the module exports. Wildcards are permitted. You can use this parameter to restrict the aliases that are exported by the module. It can remove aliases from the list of exported aliases, but it cannot add aliases to the list. If you omit this parameter, New-ModuleManifest creates an AliasesToExport key with a value of * (all), meaning that all aliases that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ClrVersion</maml:name> <maml:description> <maml:para>Specifies the version of the Common Language Runtime (CLR) of the Microsoft .NET Framework that the module requires. If you omit this parameter, New-ModuleManifest creates a CLRVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>CmdletsToExport</maml:name> <maml:description> <maml:para>Specifies the cmdlets that the module exports. Wildcards are permitted. You can use this parameter to restrict the cmdlets that are exported by the module. It can remove cmdlets from the list of exported cmdlets, but it cannot add cmdlets to the list. If you omit this parameter, New-ModuleManifest creates a CmdletsToExport key with a value of * (all), meaning that all cmdlets that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>DotNetFrameworkVersion</maml:name> <maml:description> <maml:para>Specifies the version of the Microsoft .NET Framework that the module requires. If you omit this parameter, New-ModuleManifest creates a DotNetFrameWorkVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>FunctionsToExport</maml:name> <maml:description> <maml:para>Specifies the functions that the module exports. Wildcards are permitted. You can use this parameter to restrict the functions that are exported by the module. It can remove functions from the list of exported aliases, but it cannot add functions to the list. If you omit this parameter, New-ModuleManifest creates an FunctionsToExport key with a value of * (all), meaning that all functions that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Guid</maml:name> <maml:description> <maml:para>Specifies a unique identifier for the module. The GUID can be used to distinguish among modules with the same name. If you omit this parameter, New-ModuleManifest creates a GUID key in the manifest and generates a GUID for the value. To create a new GUID in Windows PowerShell, type "[guid]::NewGuid()". </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleList</maml:name> <maml:description> <maml:para>Lists all modules that are packaged with this module. Enter each module name as a string or enter a hash table with ModuleName and GUID keys. The hash table can also have an optional ModuleVersion key. This key is designed to act as a module inventory. These modules are not automatically processed. If you omit this parameter, New-ModuleManifest creates a ModuleList key in the manifest with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleVersion</maml:name> <maml:description> <maml:para>Specifies the version of the module. This parameter is not required by the cmdlet, but a ModuleVersion key is required in the manifest. If you omit this parameter, New-ModuleManifest creates a ModuleVersion key with a value of "1.0".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Writes the resulting module manifest to the console, in addition to creating a .psd1 file. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellHostName</maml:name> <maml:description> <maml:para>Specifies the name of the Windows PowerShell host program that the module requires. Enter the name of the host program, such as "Windows PowerShell ISE Host" or "ConsoleHost". Wildcards are not permitted. To find the name of a host program, in the program, type "$host.name". If you omit this parameter, New-ModuleManifest creates a PowerShellHostName key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellHostVersion</maml:name> <maml:description> <maml:para>Specifies the minimum version of the Windows PowerShell host program that works with the module. Enter a version number, such as 1.1. If you omit this parameter, New-ModuleManifest creates a PowerShellHostName key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellVersion</maml:name> <maml:description> <maml:para>Specifies the minimum version of Windows PowerShell that will work with this module. Enter 1.0 or 2.0. Requirements for versions greater than 2.0 are not enforced. If you omit this parameter, New-ModuleManifest creates a PowerShellVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PrivateData</maml:name> <maml:description> <maml:para>Specifies data that is passed to the module when it is imported. If you omit this parameter, New-ModuleManifest creates a PrivateData key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProcessorArchitecture</maml:name> <maml:description> <maml:para>Specifies the processor architecture that the module requires. Valid values are x86, AMD64, IA64, and None (unknown or unspecified). If you omit this parameter, New-ModuleManifest creates a ProcessorArchitecture key with an empty string value.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >None</command:parameterValue> <command:parameterValue required="false" variableLength="false" >MSIL</command:parameterValue> <command:parameterValue required="false" variableLength="false" >X86</command:parameterValue> <command:parameterValue required="false" variableLength="false" >IA64</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Amd64</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>RequiredModules</maml:name> <maml:description> <maml:para>Specifies modules that must be in the global session state. If the required modules are not in the global session state, attempts to import this module will fail. Enter each module name as a string or enter a hash table with the ModuleName and GUID keys. The hash table can also have an optional ModuleVersion key. For more information, see the examples. Windows PowerShell does not import required modules automatically. It verifies only that the required modules are present. However, modules can include scripts (.ps1) that import the required modules into the global session state. If you omit this parameter, New-ModuleManifest creates a RequiredModules key with an empty array value. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ScriptsToProcess</maml:name> <maml:description> <maml:para>Specifies script (.ps1) files that run in the caller's session state when the module is imported. You can use these scripts to prepare an environment, just as you might use a login script. To specify scripts that run in the module's session state, use the NestedModules key. If you omit this parameter, New-ModuleManifest creates a ScriptsToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>VariablesToExport</maml:name> <maml:description> <maml:para>Specifies the variables that the module exports. Wildcards are permitted. You can use this parameter to restrict the variables that are exported by the module. It can remove variables from the list of exported variables, but it cannot add variables to the list. If you omit this parameter, New-ModuleManifest creates a VariablesToExport key with a value of * (all), meaning that all variables that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>AliasesToExport</maml:name> <maml:description> <maml:para>Specifies the aliases that the module exports. Wildcards are permitted. You can use this parameter to restrict the aliases that are exported by the module. It can remove aliases from the list of exported aliases, but it cannot add aliases to the list. If you omit this parameter, New-ModuleManifest creates an AliasesToExport key with a value of * (all), meaning that all aliases that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>* (all)</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Author</maml:name> <maml:description> <maml:para>Specifies the module author. This parameter is required by the cmdlet, but the Author key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates an Author key with the name of the current user.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Name of the current user</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ClrVersion</maml:name> <maml:description> <maml:para>Specifies the version of the Common Language Runtime (CLR) of the Microsoft .NET Framework that the module requires. If you omit this parameter, New-ModuleManifest creates a CLRVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>CmdletsToExport</maml:name> <maml:description> <maml:para>Specifies the cmdlets that the module exports. Wildcards are permitted. You can use this parameter to restrict the cmdlets that are exported by the module. It can remove cmdlets from the list of exported cmdlets, but it cannot add cmdlets to the list. If you omit this parameter, New-ModuleManifest creates a CmdletsToExport key with a value of * (all), meaning that all cmdlets that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>* (all)</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CompanyName</maml:name> <maml:description> <maml:para>Identifies the company or vendor who created the module. This parameter is required by the cmdlet, but the CompanyName key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a CompanyName key with a value of "Unknown".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>"Unknown"</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Copyright</maml:name> <maml:description> <maml:para>Specifies a copyright statement for the module. This parameter is required by the cmdlet, but the Copyright key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a Copyright key with a value of "(c) <year> <username>. All rights reserved." where <year> is the current year and <username> is the value of the Author key (if one is specified) or the name of the current user.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>(c) <year> <username>. All rights reserved.</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Description</maml:name> <maml:description> <maml:para>Describes the contents of the module. This parameter is required by the cmdlet, but the Description key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a Description key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>DotNetFrameworkVersion</maml:name> <maml:description> <maml:para>Specifies the version of the Microsoft .NET Framework that the module requires. If you omit this parameter, New-ModuleManifest creates a DotNetFrameWorkVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>FileList</maml:name> <maml:description> <maml:para>Specifies all items that are included in the module. This key is designed to act as a module inventory. These files are not automatically exported with the module. This parameter is required by the cmdlet, but the FileList key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a FileList key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>FormatsToProcess</maml:name> <maml:description> <maml:para>Specifies the formatting files (.ps1xml) that run when the module is imported. When you import a module, Windows PowerShell runs the Update-FormatData cmdlet with the specified files. Because formatting files are not scoped, they affect all session states in the session. This parameter is required by the cmdlet, but the FormatsToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a FormatsToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>FunctionsToExport</maml:name> <maml:description> <maml:para>Specifies the functions that the module exports. Wildcards are permitted. You can use this parameter to restrict the functions that are exported by the module. It can remove functions from the list of exported aliases, but it cannot add functions to the list. If you omit this parameter, New-ModuleManifest creates an FunctionsToExport key with a value of * (all), meaning that all functions that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>* (all)</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Guid</maml:name> <maml:description> <maml:para>Specifies a unique identifier for the module. The GUID can be used to distinguish among modules with the same name. If you omit this parameter, New-ModuleManifest creates a GUID key in the manifest and generates a GUID for the value. To create a new GUID in Windows PowerShell, type "[guid]::NewGuid()". </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>A GUID generated for the module</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleList</maml:name> <maml:description> <maml:para>Lists all modules that are packaged with this module. Enter each module name as a string or enter a hash table with ModuleName and GUID keys. The hash table can also have an optional ModuleVersion key. This key is designed to act as a module inventory. These modules are not automatically processed. If you omit this parameter, New-ModuleManifest creates a ModuleList key in the manifest with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleToProcess</maml:name> <maml:description> <maml:para>Specifies the primary or "root" file of the module. When the module is imported, the members that are exported from the root module file are imported into the caller's session state. Enter the file name of one script module (.psm1) or binary module (.dll). If a module has a manifest file and no root file has been designated in the ModuleToProcess key, the manifest becomes the primary file for the module, and the module becomes a "manifest module" (ModuleType = Manifest). To export members from .psm1 or .dll files in a module that has a manifest, the names of those files must be specified in the values of the ModuleToProcess or NestedModules keys in the manifest. Otherwise, their members are not exported. This parameter is required by the cmdlet, but the ModuleToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a ModuleToProcess key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ModuleVersion</maml:name> <maml:description> <maml:para>Specifies the version of the module. This parameter is not required by the cmdlet, but a ModuleVersion key is required in the manifest. If you omit this parameter, New-ModuleManifest creates a ModuleVersion key with a value of "1.0".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>1.0</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>NestedModules</maml:name> <maml:description> <maml:para>Specifies script modules (.psm1) and binary modules (.dll) that are imported into the module's session state. The files in the NestedModules key run in the order in which they are listed in the value. Typically, nested modules contain commands that the root module needs for its internal processing. By default, the commands in nested modules are exported from the module's session state into the caller's session state, but the root module can restrict the commands that it exports (for example, by using an Export-Module command). Nested modules in the module session state are available to the root module, but they are not returned by a Get-Module command in the caller's session state. Scripts (.ps1) that are listed in the NestedModules key are run in the module's session state, not in the caller's session state. To run a script in the caller's session state, list the script file name in the value of the ScriptsToProcess key in the manifest. This parameter is required by the cmdlet, but the NestedModules key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a NestedModules key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Writes the resulting module manifest to the console, in addition to creating a .psd1 file. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path and file name of the new module manifest. Enter a path and file name with a .psd1 file name extension, such as "$pshome\Modules\MyModule\MyModule.psd1". This parameter is required. If you specify the path to an existing file, New-ModuleManifest replaces the file without warning unless the file has the read-only attribute. The manifest should be located in the module's directory, and the manifest file name should be the same as the module directory name, but with a .psd1 file name extension. Note: You cannot use variables, such as $pshome or $home, in response to a prompt for a Path parameter value. To use a variable, include the Path parameter in the command. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellHostName</maml:name> <maml:description> <maml:para>Specifies the name of the Windows PowerShell host program that the module requires. Enter the name of the host program, such as "Windows PowerShell ISE Host" or "ConsoleHost". Wildcards are not permitted. To find the name of a host program, in the program, type "$host.name". If you omit this parameter, New-ModuleManifest creates a PowerShellHostName key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellHostVersion</maml:name> <maml:description> <maml:para>Specifies the minimum version of the Windows PowerShell host program that works with the module. Enter a version number, such as 1.1. If you omit this parameter, New-ModuleManifest creates a PowerShellHostName key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PowerShellVersion</maml:name> <maml:description> <maml:para>Specifies the minimum version of Windows PowerShell that will work with this module. Enter 1.0 or 2.0. Requirements for versions greater than 2.0 are not enforced. If you omit this parameter, New-ModuleManifest creates a PowerShellVersion key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PrivateData</maml:name> <maml:description> <maml:para>Specifies data that is passed to the module when it is imported. If you omit this parameter, New-ModuleManifest creates a PrivateData key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProcessorArchitecture</maml:name> <maml:description> <maml:para>Specifies the processor architecture that the module requires. Valid values are x86, AMD64, IA64, and None (unknown or unspecified). If you omit this parameter, New-ModuleManifest creates a ProcessorArchitecture key with an empty string value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ProcessorArchitecture</command:parameterValue> <dev:type> <maml:name>ProcessorArchitecture</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>RequiredAssemblies</maml:name> <maml:description> <maml:para>Specifies the assembly (.dll) files that the module requires. Windows PowerShell loads the specified assemblies before updating types or formats, importing nested modules, or importing the module file that is specified in the value of the ModuleToProcess key. Use this parameter to list all the assemblies that the module requires, including assemblies that must be loaded to update any formatting or type files that are listed in the FormatsToProcess or TypesToProcess keys, even if those assemblies are also listed as binary modules in the NestedModules key. This parameter is required by the cmdlet, but the RequiredAssemblies key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a RequiredAssemblies key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>RequiredModules</maml:name> <maml:description> <maml:para>Specifies modules that must be in the global session state. If the required modules are not in the global session state, attempts to import this module will fail. Enter each module name as a string or enter a hash table with the ModuleName and GUID keys. The hash table can also have an optional ModuleVersion key. For more information, see the examples. Windows PowerShell does not import required modules automatically. It verifies only that the required modules are present. However, modules can include scripts (.ps1) that import the required modules into the global session state. If you omit this parameter, New-ModuleManifest creates a RequiredModules key with an empty array value. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ScriptsToProcess</maml:name> <maml:description> <maml:para>Specifies script (.ps1) files that run in the caller's session state when the module is imported. You can use these scripts to prepare an environment, just as you might use a login script. To specify scripts that run in the module's session state, use the NestedModules key. If you omit this parameter, New-ModuleManifest creates a ScriptsToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>TypesToProcess</maml:name> <maml:description> <maml:para>Specifies the type files (.ps1xml) that run when the module is imported. When you import the module, Windows PowerShell runs the Update-TypeData cmdlet with the specified files. Because type files are not scoped, they affect all session states in the session. This parameter is required by the cmdlet, but the TypesToProcess key is not required in the manifest. If you omit this parameter and do not enter a value when prompted, New-ModuleManifest creates a TypesToProcess key with an empty array value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="false" position="named"> <maml:name>VariablesToExport</maml:name> <maml:description> <maml:para>Specifies the variables that the module exports. Wildcards are permitted. You can use this parameter to restrict the variables that are exported by the module. It can remove variables from the list of exported variables, but it cannot add variables to the list. If you omit this parameter, New-ModuleManifest creates a VariablesToExport key with a value of * (all), meaning that all variables that are exported by the module are exported by the manifest.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>* (all)</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or System.String</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> By default, New-ModuleManifest does not generate any output. However, if you use the PassThru parameter, it generates a System.String object representing the module manifest.. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> Module manifests are usually optional. However, a module manifest is required to export an assembly that is installed in the global assembly cache. To add or change files in the $pshome\Modules directory (%Windir%\System32\WindowsPowerShell\v1.0\Modules), start Windows PowerShell with the "Run as administrator" option. A "session" is an instance of the Windows PowerShell execution environment. A session can have one or more session state. By default, a session has only a global session state, but each imported module has its own session state. Session states allow the commands in a module to run without affecting the global session state. The "caller's session state" is the session state into which a module is imported. Typically, it refers to the global session state, but when a module imports nested modules, the "caller" is the module and the "caller's session state" is the module's session state. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> New-ModuleManifest Path: C:\Users\User01\Documents\WindowsPowerShell\Modules\Test-Module\Test-Module.psd1 NestedModules[0]: BackgroundModule.psm1 Author: Jinghao Liu CompanyName: Fabrikam, Inc. Copyright: Copyright © 2009 Liu Jinghao. All rights reserved. ModuleToProcess: TestModule.psm1 Description: Cmdlets to find common errors in scripts. TypesToProcess[0]: TestTypes.ps1xml FormatsToProcess[0]: TestFormat.ps1xml RequiredAssemblies[0]: Test.dll FileList[0]: Test-Module.psd1 FileList[1]: Test-Module.psm1 FileList[2]: BackgroundModule.psm1 FileList[3]: TestTypes.ps1xml FileList[4]: TestFormat.ps1xml FileList[5]: Test.dll FileList[6]: TestIcon.ico </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new module manifest. The cmdlet prompts you for the parameters that it requires, including the Path parameter, and creates a manifest file in the specified location. The output of this command shows sample responses to the prompts. To use default values, press ENTER. The actual prompt, and its handling of quoted and non-quoted phrases, depends on the host program in which Windows PowerShell is running.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> New-ModuleManifest -PowerShellVersion 1.0 -AliasesToExport JKBC, DRC, TAC </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new module manifest. The command includes parameters that the cmdlet does not require (or prompt for). You can include other manifest key values at the prompt.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> New-ModuleManifest -RequiredModules FileTransfer,@{ModuleName="BackgroundModule";GUID="486569a2-2784-48bf-af15-70ba837a64d0";ModuleVersion="3.5"} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the string and hash table formats of the RequiredModules parameter value. Strings and hash tables can be used in the same command. This command commands creates a module manifest for a module that requires the FileTransfer module and a (fictitious) module named "BackgroundModule". The command uses a string format to specify the name of the FileTransfer module and the hash table format to specify the name, a GUID, and a version of the BackgroundModule.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141555</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Export-ModuleMember</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-ModuleManifest</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> New-PSSession </command:name> <maml:description> <maml:para>Creates a persistent connection to a local or remote computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>New</command:verb> <command:noun>PSSession</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The New-PSSession cmdlet creates a Windows PowerShell session (PSSession) on a local or remote computer. When you create a PSSession, Windows PowerShell establishes a persistent connection to the remote computer. Use a PSSession to run multiple commands that share data, such as a function or the value of a variable. To run commands in a PSSession, use the Invoke-Command cmdlet. To use the PSSession to interact directly with a remote computer, use the Enter-PSSession cmdlet. For more information, see about_PSSessions. You can run commands on a remote computer without creating a PSSession by using the ComputerName parameters of Enter-PSSession or Invoke-Command. When you use the ComputerName parameter, Windows PowerShell creates a temporary connection that is used for the interactive session or for a single command and is then closed. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>New-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Creates a persistent connection (PSSession) to the specified computer. If you enter multiple computer names, New-PSSession creates multiple PSSessions, one for each computer. The default is the local computer. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. To specify the local computer, type the computer name, "localhost", or a dot (.). When the computer is in a different domain than the user, the fully qualified domain name is required. You can also pipe a computer name (in quotes) to New-PSSession. To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: In Windows Vista and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is "WSMAN". This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For more information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource Uniform Resource Identifier (URI) for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the PSSession. You can use the name to refer to the PSSession when using other cmdlets, such as Get-PSSession and Enter-PSSession. The name is not required to be unique to the computer or the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer that is used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. Use the following commands to configure the listener: 1. winrm delete winrm/config/listener?Address=*+Transport=HTTP 2. winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port=&quot;&lt;port-number&gt;&quot;} Do not use the Port parameter unless you must. The port setting in the command applies to all computers and sessions in which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Uses the specified PSSession as a model for the new PSSession. This parameter creates new PSSessions with the same properties as the specified PSSessions. Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. The resulting PSSessions have the same computer name, application name, connection URI, port, configuration name, throttle limit, and Secure Sockets Layer (SSL) value as the originals, but they have a different display name, ID, and instance ID (GUID).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the PSSession. You can use the name to refer to the PSSession when using other cmdlets, such as Get-PSSession and Enter-PSSession. The name is not required to be unique to the computer or the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-PSSession</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified. The format of this string is as follows: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is as follows: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Uri[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter, and see New-PSSessionOption. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For more information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource Uniform Resource Identifier (URI) for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the PSSession. You can use the name to refer to the PSSession when using other cmdlets, such as Get-PSSession and Enter-PSSession. The name is not required to be unique to the computer or the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AllowRedirection</maml:name> <maml:description> <maml:para>Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection. You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter. The default value is 5. For more information, see the description of the SessionOption parameter, and see New-PSSessionOption. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command. The default value is the value of the $PSSessionApplicationName preference variable on the local computer. If this preference variable is not defined, the default value is "WSMAN". This value is appropriate for most uses. For more information, see about_Preference_Variables. The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>WSMAN</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are "Default", "Basic", "Credssp", "Digest", "Kerberos", "Negotiate", and "NegotiateWithImplicitCredential". The default value is "Default". CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For more information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=144382. Caution: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AuthenticationMechanism</command:parameterValue> <dev:type> <maml:name>AuthenticationMechanism</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Default</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies the digital public key certificate (X509) of a user account that has permission to perform this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts. To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Creates a persistent connection (PSSession) to the specified computer. If you enter multiple computer names, New-PSSession creates multiple PSSessions, one for each computer. The default is the local computer. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. To specify the local computer, type the computer name, "localhost", or a dot (.). When the computer is in a different domain than the user, the fully qualified domain name is required. You can also pipe a computer name (in quotes) to New-PSSession. To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see "How to Add a Computer to the Trusted Host List" in about_Remote_Troubleshooting. Note: In Windows Vista and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>ConfigurationName</maml:name> <maml:description> <maml:para>Specifies the session configuration that is used for the new PSSession. Enter a configuration name or the fully qualified resource Uniform Resource Identifier (URI) for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails. The default value is the value of the $PSSessionConfigurationName preference variable on the local computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more information, see about_Preference_Variables.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ConnectionURI</maml:name> <maml:description> <maml:para>Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified. The format of this string is as follows: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is as follows: http://localhost:80/WSMAN Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values. If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Uri[]</command:parameterValue> <dev:type> <maml:name>Uri[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or "User@Domain.com", or enter a PSCredential object, such as one returned by the Get-Credential cmdlet. When you type a user name, you will be prompted for a password.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the PSSession. You can use the name to refer to the PSSession when using other cmdlets, such as Get-PSSession and Enter-PSSession. The name is not required to be unique to the computer or the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the network port on the remote computer that is used for this command. The default is port 80 (the HTTP port). Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. Use the following commands to configure the listener: 1. winrm delete winrm/config/listener?Address=*+Transport=HTTP 2. winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port=&quot;&lt;port-number&gt;&quot;} Do not use the Port parameter unless you must. The port setting in the command applies to all computers and sessions in which the command runs. An alternate port setting might prevent the command from running on all computers.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>80</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Uses the specified PSSession as a model for the new PSSession. This parameter creates new PSSessions with the same properties as the specified PSSessions. Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. The resulting PSSessions have the same computer name, application name, connection URI, port, configuration name, throttle limit, and Secure Sockets Layer (SSL) value as the originals, but they have a different display name, ID, and instance ID (GUID).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> <dev:type> <maml:name>PSSession[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SessionOption</maml:name> <maml:description> <maml:para>Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet. The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. Otherwise, the session uses the system defaults. For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference variable, see about_Preference_Variables. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSSessionOption</command:parameterValue> <dev:type> <maml:name>PSSessionOption</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThrottleLimit</maml:name> <maml:description> <maml:para>Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>32</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseSSL</maml:name> <maml:description> <maml:para>Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used. WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. If you use this parameter, but SSL is not available on the port used for the command, the command fails.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String, System.URI, System.Management.Automation.Runspaces.PSSession</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a ComputerName (string), ConnectionURI (URI), or Session (PSSession) object to New-PSSession. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.Runspaces.PSSession</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> This cmdlet uses the Windows PowerShell remoting infrastructure. To use this cmdlet, the local computer and any remote computers must be configured for Windows PowerShell remoting. For more information, see about_Remote_Requirements. In Windows Vista and later versions of Windows, to create a PSSession on the local computer, you must start Windows PowerShell with the "Run as administrator" option. When you are finished with the PSSession, use the Remove-PSSession cmdlet to delete the PSSession and release its resources. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new PSSession on the local computer and saves the PSSession in the $s variable. You can now use this PSSession to run commands on the local computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $Server01 = new-pssession -ComputerName Server01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new PSSession on the Server01 computer and saves it in the $Server01 variable. When creating multiple PSSessions, assign them to variables with useful names. This will help you manage the PSSessions in subsequent commands.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s1, $s2, $s3 = new-session -computername server1,server2,server3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates three new PSSessions, one on each of the computers specified by the ComputerName parameter. The command uses the assignment operator (=) to assign the new PSSessions to an array of variables: $s1, $s2, $s3. It assigns the Server01 PSSession to $s1, the Server02 PSSession to $s2, and the Server03 PSSession to $s3. When you assign multiple objects to an array of variables, Windows PowerShell assigns each object to a variable in the array respectively. If there are more objects than variables, all remaining objects are assigned to the last variable. If there are more variables than objects, the remaining variables are empty (null).</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-pssession -computername Server01 -port 8081 -useSSL -ConfigurationName E12 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new PSSession on the Server01 computer that connects to server port 8081 and uses the SSL protocol. The new PSSession uses an alternate session configuration called "E12". Before setting the port, you must configure the WinRM listener on the remote computer to listen on port 8081. For more information, see the description of the Port parameter.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-pssession -session $s -credential domain01\user01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new PSSession with the same properties as an existing PSSession. You can use this command format when the resources of an existing PSSession are exhausted and a new PSSession is needed to offload some of the demand. The command uses the Session parameter of New-PSSession to specify the PSSession saved in the $s variable. It uses the credentials of the Domain1\Admin01 user to complete the command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $global:s = new-pssession -computername server1.domain44.corpnet.fabrikam.com -credential domain01\admin01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to create a PSSession with a global scope on a computer in a different domain. By default, PSSessions created at the command line are created with local scope and PSSessions created in a script have script scope. To create a PSSession with global scope, create a new PSSession and then store the PSSession in a variable that is cast to a global scope. In this case, the $s variable is cast to a global scope. The command uses the ComputerName parameter to specify the remote computer. Because the computer is in a different domain than the user account, the full name of the computer is specified along with the credentials of the user.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $rs = get-content c:\test\servers.txt | new-PSsession -throttleLimit 50 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a PSSession on each of the 200 computers listed in the Servers.txt file and it stores the resulting PSSession in the $rs variable. The PSSessions have a throttle limit of 50. You can use this command format when the names of computers are stored in a database, spreadsheet, text file, or other text-convertible format.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-PSSession -URI http://Server01:91/NewSession -credential domain01\user01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a PSSession on the Server01 computer and stores it in the $s variable. It uses the URI parameter to specify the transport protocol, the remote computer, the port, and an alternate session configuration. It also uses the Credential parameter to specify a user account with permission to create a session on the remote computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-PSSession -computername (import-csv servers.csv) -credential domain01\admin01 -throttlelimit 16 C:\PS> invoke-command -session $s -scriptblock {get-process powershell} -AsJob </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands create a set of PSSessions and then run a background job in each of the PSSessions. The first command creates a new PSSession on each of the computers listed in the Servers.csv file. It uses the New-PSSession cmdlet to create the PSSession. The value of the ComputerName parameter is a command that uses the Import-Csv cmdlet to import the Servers.csv file and read its contents. The command uses the Credential parameter to create the PSSessions with the permission of a domain administrator, and it uses the ThrottleLimit parameter to limit the command to 16 concurrent connections. The command saves the PSSessions in the $s variable. The second command uses the AsJob parameter of Invoke-Command to start a background job that runs a "Get-Process PowerShell" command in each of the PSSessions in $s. For more information about background jobs, see about_Jobs and about_Remote_Jobs.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 10 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> new-PSSession -ConnectionURI https://management.exchangelabs.com/Management </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a new PSSession that connects to a computer that is specified by a URI instead of a computer name.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 11 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $so = New-WSManSessionOption -SkipCACheck PS C:\> new-pssession -ConnectionUri https://management.exchangelabs.com/Management -SessionOption $so -credential server01\admin01 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to create and use a SessionOption parameter. The first command uses the New-WSManSessionOption cmdlet to create a session option. It saves the resulting SessionOption object in the $so parameter. The second command uses the option in a new session. The command uses the New-PSSession cmdlet to create a new session. The value of the SessionOption parameter is the SessionOption object in the $so variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135237</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exit-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> New-PSSessionOption </command:name> <maml:description> <maml:para>Creates an object that contains advanced options for a PSSession. </maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>New</command:verb> <command:noun>PSSessionOption</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The New-PSSessionOption cmdlet creates an object that contains advanced options for a PSSession. You can use the object as the value of the SessionOption parameter of cmdlets that create a PSSession, such as New-PSSession, Enter-PSSession, and Invoke-Command. Without parameters, New-PSSessionOption generates an object that contains the default values for all of the options. Because all of the properties can be edited, you can use the resulting object as a template, and create standard option objects for your enterprise.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>New-PSSessionOption</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationArguments</maml:name> <maml:description> <maml:para>Specifies a hash table that is sent directly to the session configuration without interpretation. This hash table is available to the session configuration as a property of the PSSenderInfo class.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSPrimitiveDictionary</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CancelTimeOut</maml:name> <maml:description> <maml:para>Determines how long Windows PowerShell waits for a cancel operation (CTRL + C) to complete before terminating it. Enter a value in milliseconds. The default value is 60000 (one minute). A value of 0 (zero) means no timeout; the command continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Culture</maml:name> <maml:description> <maml:para>Specifies the culture to use for the PSSession. Enter a culture name in <languagecode2>-<country/regioncode2> format, such as "ja-jP", a variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as "get-culture". The default value is $null, and the culture that is set in the operating system when the PSSession is created is used in the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CultureInfo</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>IdleTimeOut</maml:name> <maml:description> <maml:para>Determines how long the PSSession stays open if the remote computer does not receive any communication from the local computer, including the heartbeat signal. When the interval expires, the PSSession closes. Enter a value in milliseconds. The default value is 240000 (4 minutes). The minimum value is 60000 (1 minute). If both the local and remote computers specify an idle timeout value, the PSSession uses the shorter timeout value. The local computer can set an idle timeout value by using this parameter or by setting an idle timeout in the $PSSessionOption preference variable. The remote computer can specify an idle timeout value in the WS-Management configuration (WSMAN:\localhost\shell\idletimeout).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommand</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes that the local computer can receive from the remote computer in a single command. Enter a value in bytes. By default, there is no data size limit. This option is designed to protect the resources on the client computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSize</maml:name> <maml:description> <maml:para>Specifies the maximum size of an object that the local computer can receive from the remote computer. Enter a value in bytes. By default, there is no data size limit. This option is designed to protect the resources on the client computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumRedirection</maml:name> <maml:description> <maml:para>Determines how many times Windows PowerShell redirects a connection to an alternate Uniform Resource Identifier (URI) before the connection fails. The default value is 5. A value of 0 (zero) prevents all redirection. This option is used in the PSSession only when the AllowRedirection parameter is used in the command that creates the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoCompression</maml:name> <maml:description> <maml:para>Turns off packet compression in the PSSession. Compression uses more processor cycles, but it makes transmission faster. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoEncryption</maml:name> <maml:description> <maml:para>Turns off data encryption. </maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoMachineProfile</maml:name> <maml:description> <maml:para>Prevents loading the user's Windows user profile. As a result, the PSSession might be created faster, but user-specific registry settings, items such as environment variables, and certificates are not available in the PSSession.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>OpenTimeOut</maml:name> <maml:description> <maml:para>Determines how long the client computer waits for the session connection to be established. When the interval expires, the command to establish the connection fails. Enter a value in milliseconds. The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the command continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>OperationTimeOut</maml:name> <maml:description> <maml:para>Determines the maximum time that any operation in the PSSession can run. When the interval expires, the operation fails. Enter a value in milliseconds. The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the operation continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyAccessType</maml:name> <maml:description> <maml:para>Determines which mechanism is used to resolve the host name. Valid values are IEConfig, WinHttpConfig, AutoDetect, NoProxyServer and None. The default value is None. For information about the values of this parameter, see the description of the System.Management.Automation.Remoting.ProxyAccessType enumeration in the MSDN (Microsoft Developer Network) Library at http://go.microsoft.com/fwlink/?LinkId=144756. </maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >None</command:parameterValue> <command:parameterValue required="false" variableLength="false" >IEConfig</command:parameterValue> <command:parameterValue required="false" variableLength="false" >WinHttpConfig</command:parameterValue> <command:parameterValue required="false" variableLength="false" >AutoDetect</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NoProxyServer</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyAuthentication</maml:name> <maml:description> <maml:para>Specifies the authentication method that is used for proxy resolution. Valid values are Basic, Digest, and Negotiate. The default value is Negotiate. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN library at http://go.microsoft.com/fwlink/?LinkID=144382.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyCredential</maml:name> <maml:description> <maml:para>Specifies the credentials to use for proxy authentication. Enter a variable that contains a PSCredential object or a command that gets a PSCredential object, such as Get-Credential. If this option is not set, no credentials are specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipCACheck</maml:name> <maml:description> <maml:para>Specifies that when connecting over HTTPS, the client does not validate that the server certificate is signed by a trusted certificate authority (CA). Use this option only when the remote computer is trusted by using another mechanism, such as when the remote computer is part of a network that is physically secure and isolated, or the remote computer is listed as a trusted host in a WinRM configuration.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipCNCheck</maml:name> <maml:description> <maml:para>Specifies that the certificate common name (CN) of the server does not need to match the hostname of the server. This option is used only in remote operations that use the HTTPS protocol. Use this option only for trusted computers.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipRevocationCheck</maml:name> <maml:description> <maml:para>Does not validate the revocation status of the server certificate.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UICulture</maml:name> <maml:description> <maml:para>Specifies the UI culture to use for the PSSession. Enter a culture name in <languagecode2>-<country/regioncode2> format, such as "ja-jP", a variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as Get-Culture. The default value is $null, and the UI culture that is set in the operating system when the PSSession is created is used in the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CultureInfo</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseUTF16</maml:name> <maml:description> <maml:para>Encode the request in UTF16 format rather than UTF8 format. </maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationArguments</maml:name> <maml:description> <maml:para>Specifies a hash table that is sent directly to the session configuration without interpretation. This hash table is available to the session configuration as a property of the PSSenderInfo class.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSPrimitiveDictionary</command:parameterValue> <dev:type> <maml:name>PSPrimitiveDictionary</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>CancelTimeOut</maml:name> <maml:description> <maml:para>Determines how long Windows PowerShell waits for a cancel operation (CTRL + C) to complete before terminating it. Enter a value in milliseconds. The default value is 60000 (one minute). A value of 0 (zero) means no timeout; the command continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>60000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Culture</maml:name> <maml:description> <maml:para>Specifies the culture to use for the PSSession. Enter a culture name in <languagecode2>-<country/regioncode2> format, such as "ja-jP", a variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as "get-culture". The default value is $null, and the culture that is set in the operating system when the PSSession is created is used in the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CultureInfo</command:parameterValue> <dev:type> <maml:name>CultureInfo</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Current culture</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>IdleTimeOut</maml:name> <maml:description> <maml:para>Determines how long the PSSession stays open if the remote computer does not receive any communication from the local computer, including the heartbeat signal. When the interval expires, the PSSession closes. Enter a value in milliseconds. The default value is 240000 (4 minutes). The minimum value is 60000 (1 minute). If both the local and remote computers specify an idle timeout value, the PSSession uses the shorter timeout value. The local computer can set an idle timeout value by using this parameter or by setting an idle timeout in the $PSSessionOption preference variable. The remote computer can specify an idle timeout value in the WS-Management configuration (WSMAN:\localhost\shell\idletimeout).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>240000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommand</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes that the local computer can receive from the remote computer in a single command. Enter a value in bytes. By default, there is no data size limit. This option is designed to protect the resources on the client computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>No limit</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSize</maml:name> <maml:description> <maml:para>Specifies the maximum size of an object that the local computer can receive from the remote computer. Enter a value in bytes. By default, there is no data size limit. This option is designed to protect the resources on the client computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>No limit</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumRedirection</maml:name> <maml:description> <maml:para>Determines how many times Windows PowerShell redirects a connection to an alternate Uniform Resource Identifier (URI) before the connection fails. The default value is 5. A value of 0 (zero) prevents all redirection. This option is used in the PSSession only when the AllowRedirection parameter is used in the command that creates the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>5</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoCompression</maml:name> <maml:description> <maml:para>Turns off packet compression in the PSSession. Compression uses more processor cycles, but it makes transmission faster. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoEncryption</maml:name> <maml:description> <maml:para>Turns off data encryption. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoMachineProfile</maml:name> <maml:description> <maml:para>Prevents loading the user's Windows user profile. As a result, the PSSession might be created faster, but user-specific registry settings, items such as environment variables, and certificates are not available in the PSSession.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>OpenTimeOut</maml:name> <maml:description> <maml:para>Determines how long the client computer waits for the session connection to be established. When the interval expires, the command to establish the connection fails. Enter a value in milliseconds. The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the command continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>180000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>OperationTimeOut</maml:name> <maml:description> <maml:para>Determines the maximum time that any operation in the PSSession can run. When the interval expires, the operation fails. Enter a value in milliseconds. The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the operation continues indefinitely.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>180000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyAccessType</maml:name> <maml:description> <maml:para>Determines which mechanism is used to resolve the host name. Valid values are IEConfig, WinHttpConfig, AutoDetect, NoProxyServer and None. The default value is None. For information about the values of this parameter, see the description of the System.Management.Automation.Remoting.ProxyAccessType enumeration in the MSDN (Microsoft Developer Network) Library at http://go.microsoft.com/fwlink/?LinkId=144756. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ProxyAccessType</command:parameterValue> <dev:type> <maml:name>ProxyAccessType</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyAuthentication</maml:name> <maml:description> <maml:para>Specifies the authentication method that is used for proxy resolution. Valid values are Basic, Digest, and Negotiate. The default value is Negotiate. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN library at http://go.microsoft.com/fwlink/?LinkID=144382.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AuthenticationMechanism</command:parameterValue> <dev:type> <maml:name>AuthenticationMechanism</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Negotiate</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProxyCredential</maml:name> <maml:description> <maml:para>Specifies the credentials to use for proxy authentication. Enter a variable that contains a PSCredential object or a command that gets a PSCredential object, such as Get-Credential. If this option is not set, no credentials are specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipCACheck</maml:name> <maml:description> <maml:para>Specifies that when connecting over HTTPS, the client does not validate that the server certificate is signed by a trusted certificate authority (CA). Use this option only when the remote computer is trusted by using another mechanism, such as when the remote computer is part of a network that is physically secure and isolated, or the remote computer is listed as a trusted host in a WinRM configuration.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipCNCheck</maml:name> <maml:description> <maml:para>Specifies that the certificate common name (CN) of the server does not need to match the hostname of the server. This option is used only in remote operations that use the HTTPS protocol. Use this option only for trusted computers.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SkipRevocationCheck</maml:name> <maml:description> <maml:para>Does not validate the revocation status of the server certificate.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UICulture</maml:name> <maml:description> <maml:para>Specifies the UI culture to use for the PSSession. Enter a culture name in <languagecode2>-<country/regioncode2> format, such as "ja-jP", a variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as Get-Culture. The default value is $null, and the UI culture that is set in the operating system when the PSSession is created is used in the PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CultureInfo</command:parameterValue> <dev:type> <maml:name>CultureInfo</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Current UI culture</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>UseUTF16</maml:name> <maml:description> <maml:para>Encode the request in UTF16 format rather than UTF8 format. </maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False (UTF8 encoding)</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.Remoting.PSSessionOption</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> If the SessionOption parameter is not used in a command to create a PSSession, the session options are determined by the property values of the $PSSessionOption preference variable, if it is set. For more information about the $PSSessionOption variable, see about_Preference_Variables. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> New-PSSessionOption MaximumConnectionRedirectionCount : 5 NoCompression : False NoMachineProfile : False ProxyAccessType : IEConfig ProxyAuthentication : Negotiate ProxyCredential : SkipCACheck : False SkipCNCheck : False SkipRevocationCheck : False OperationTimeout : 00:03:00 NoEncryption : False UseUTF16 : False Culture : UICulture : MaximumReceivedDataSizePerCommand : MaximumReceivedObjectSize : ApplicationArguments : OpenTimeout : 00:03:00 CancelTimeout : 00:01:00 IdleTimeout : 00:04:00 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a session option object with all of the default values.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $pso = new-pssessionoption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB C:\PS> new-pssession -computerName Server01 -SessionOption $pso </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use a session option object to configure a session. The first command creates a new session option object and saves it in the value of the $pso variable. The second command uses the New-PSSession cmdlet to create a PSSession on the Server01 remote computer. The command uses the session option object in the value of the $pso variable as the value of the SessionOption parameter of the command. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> enter-pssession -computername Server01 -sessionOption (new-pssessionoption -noEncryption -noCompression) </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Enter-PSSession cmdlet to start an interactive session with the Server01 computer. The value of the SessionOption parameter is a New-PSSessionOption command with the NoEncryption and NoCompression switch parameters. The New-PSSessionOption command is enclosed in parentheses to make sure that it runs before the Enter-PSSession command.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $a = new-pssessionoption MaximumConnectionRedirectionCount : 5 NoCompression : False NoMachineProfile : False ProxyAccessType : IEConfig ProxyAuthentication : Negotiate ProxyCredential : SkipCACheck : False SkipCNCheck : False SkipRevocationCheck : False OperationTimeout : 00:03:00 NoEncryption : False UseUTF16 : False Culture : UICulture : MaximumReceivedDataSizePerCommand : MaximumReceivedObjectSize : ApplicationArguments : OpenTimeout : 00:03:00 CancelTimeout : 00:01:00 IdleTimeout : 00:04:00 C:\PS> $a.UICulture = (get-UICulture) C:\PS> $a.OpenTimeout = (new-timespan -minutes 4) C:\PS> $a.MaximumConnectionRedirectionCount = 1 C:\PS> $a MaximumConnectionRedirectionCount : 1 NoCompression : False NoMachineProfile : False ProxyAccessType : IEConfig ProxyAuthentication : Negotiate ProxyCredential : SkipCACheck : False SkipCNCheck : False SkipRevocationCheck : False OperationTimeout : 00:03:00 NoEncryption : False UseUTF16 : False Culture : UICulture : en-US MaximumReceivedDataSizePerCommand : MaximumReceivedObjectSize : ApplicationArguments : OpenTimeout : 00:04:00 CancelTimeout : 00:01:00 IdleTimeout : 00:04:00 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example demonstrates that you can edit the session option object. All properties have read/write values. Use this method to create a standard session object for your enterprise, and then create customized versions of it for particular uses.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $PSSessionOption = New-PSSessionOption -OpenTimeOut 120000 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates a $PSSessionOption preference variable. When the $PSSessionOption preference variable exists in the session, it establishes default values for options in the PSSessions that are created by using the New-PSSession, Enter-PSSession, and Invoke-Command cmdlets. To make the $PSSessionOption variable available in all sessions, add it to your Windows PowerShell session and to your Windows PowerShell profile. For more information about the $PSSessionOption variable, see about_Preference_Variables. For more information about profiles, see about_Profiles. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $skipCN = new-pssessionoption -SkipCNCheck C:\PS> new-pssession -computername 171.09.21.207 -UseSSL -credential domain01\user01 -sessionOption $skipCN </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use a SessionOption object to fulfill the requirements for a remote session configuration. The first command uses the New-PSSessionOption cmdlet to create a session option object with the SkipCNCheck property. The command saves the resulting session object in the $skipCN variable. The second command uses the New-PSSession cmdlet to create a new PSSession on a remote computer. The $skipCN check variable is used in the value of the SessionOption parameter. Because the computer is identified by its IP address, the value of the ComputerName parameter does not match any of the common names in the certificate used for Secure Sockets Layer (SSL). As a result, the SkipCNCheck option is required.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144305</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Receive-Job </command:name> <maml:description> <maml:para>Gets the results of the Windows PowerShell background jobs in the current session. </maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Receive</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Receive-Job cmdlet gets the results of Windows Powershell background jobs. Use Receive-Job to get the results of jobs started by using the Start-Job cmdlet or the AsJob parameter of any cmdlet. You can get the results of all jobs or identify jobs by their name, ID, instance ID, computer name, location, or session, or by submitting a job object. When you start a Windows PowerShell background job, the job starts, but the results do not appear immediately. Instead, the command returns an object that represents the background job. The job object contains useful information about the job, but it does not contain the results. This method allows you to continue working in the session while the job runs. For more information about background jobs in Windows PowerShell, see about_Jobs. To get the results of the command, use the Receive-Job cmdlet. Receive-Job gets the results that have been generated by the time that the Receive-Job command is submitted. If the results are not yet complete, you can run additional Receive-Job commands to get the remaining results. By default, job results are deleted from the system when you receive them, but you can use the Keep parameter to save the results so that you can receive them again. To delete the job results, receive them again (without the Keep parameter), close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the job for which results are being retrieved. This parameter is required in a Receive-Job command. Enter a variable that contains the job or a command that gets the job. You can also pipe a job object to Receive-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Gets the results of jobs that were run on the specified computers. Enter the computer names. The default is all jobs in the current session. This parameter selects from among the job results that are stored on the local computer. It does not get data from remote computers. To get job results that are stored on remote computers, use the Invoke-Command cmdlet to run a Receive-Job command remotely. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified instance IDs. The default is all jobs in the current session. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use the Get-Job cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the job for which results are being retrieved. This parameter is required in a Receive-Job command. Enter a variable that contains the job or a command that gets the job. You can also pipe a job object to Receive-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>Location</maml:name> <maml:description> <maml:para>Gets only the results of jobs with the specified location. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified friendly name. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the job for which results are being retrieved. This parameter is required in a Receive-Job command. Enter a variable that contains the job or a command that gets the job. You can also pipe a job object to Receive-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>Session</maml:name> <maml:description> <maml:para>Gets the results of jobs that were run in the specified Windows Powershell session (PSSession). Enter a variable that contains the PSSession or a command that gets the PSSession, such as a Get-PSSession command. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Receive-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified IDs. The default is all jobs in the current session. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Gets the results of jobs that were run on the specified computers. Enter the computer names. The default is all jobs in the current session. This parameter selects from among the job results that are stored on the local computer. It does not get data from remote computers. To get job results that are stored on remote computers, use the Invoke-Command cmdlet to run a Receive-Job command remotely. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified IDs. The default is all jobs in the current session. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified instance IDs. The default is all jobs in the current session. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use the Get-Job cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the job for which results are being retrieved. This parameter is required in a Receive-Job command. Enter a variable that contains the job or a command that gets the job. You can also pipe a job object to Receive-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> <dev:type> <maml:name>Job[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Keep</maml:name> <maml:description> <maml:para>Saves the job results in the system, even after you have received them. By default, the job results are deleted when they are retrieved. To delete the results, use Receive-Job to receive them again without the Keep parameter, close the session, or use the Remove-Job cmdlet to delete the job from the session.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>Location</maml:name> <maml:description> <maml:para>Gets only the results of jobs with the specified location. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Gets the results of jobs with the specified friendly name. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoRecurse</maml:name> <maml:description> <maml:para>Gets results only from the specified job. By default, Receive-Job also gets the results of all child jobs of the specified job.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2"> <maml:name>Session</maml:name> <maml:description> <maml:para>Gets the results of jobs that were run in the specified Windows Powershell session (PSSession). Enter a variable that contains the PSSession or a command that gets the PSSession, such as a Get-PSSession command. The default is all jobs in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> <dev:type> <maml:name>PSSession[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.Job</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe job objects to Receive-Job. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Receive-Job returns the results of the commands in the job. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $job = start-job -scriptblock {get-process} C:\PS> receive-job -job $job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands use the Job parameter to get the results of a particular job. The first command uses the Start-Job cmdlet to start a job that runs a "Get-Process" command. The command uses the assignment operator (=) to save the resulting job object in the $job variable. The second command uses the Receive-Job cmdlet to get the results of the job. It uses the Job parameter to specify the job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $job = start-job -scriptblock {get-process} C:\PS> $job | receive-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example is the same as Example 2, except that the command uses a pipeline operator (|) to send the job object to Receive-Job. As a result, the command does not need a Job parameter to specify the job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = invoke-command -computername Server01, Server02, Server03 -scriptblock {get-service} -AsJob C:\PS> $j.childjobs Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 2 Job2 Completed True Server01 get-service 3 Job3 Completed True Server02 get-service 4 Job4 Completed True Server03 get-service C:\PS> receive-job -name Job3 -keep Status Name DisplayName PSComputerName ------ ----------- ----------- -------------- Running AeLookupSvc Application Experience Server02 Stopped ALG Application Layer Gateway Service Server02 Running Appinfo Application Information Server02 Running AppMgmt Application Management Server02 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands use the Name parameter of Receive-Job to get the results of one of several background jobs run on remote computers. The first command uses the Invoke-Command cmdlet to start a background job that runs a Get-Service command on three remote computers. The command uses the AsJob parameter to run the command as a background job. The command saves the resulting job object in the $j variable. When you use the AsJob parameter of Invoke-Command to start a job, the job object is created on the local computer, even though the job runs on the remote computers. As a result, you use local commands to manage the job. Also, when you use AsJob, Windows PowerShell returns one job object that contains a child job for each job that was started. In this case, the job object contains three child jobs, one for each job on each remote computer. The second command uses the dot method to display the value of the ChildJobs property of the job object in $j. The display shows that the command created three child jobs, one for the job on each remote computer. The third command uses the Receive-Job cmdlet to get the results of the Job3 child job that ran on the Server02 computer. It uses the Name parameter to specify the name of the child job and the Keep parameter to save the job results even after they are received.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01, Server02, Server03 C:\PS> $j = invoke-command -session $s -scriptblock {start-job -scriptblock {get-eventlog -logname system}} C:\PS> $j Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Completed True Localhost get-eventlog system 2 Job2 Completed True Localhost get-eventlog system 3 Job3 Completed True Localhost get-eventlog system C:\PS> $results = invoke-command -session $s -scriptblock {param($j) receive-job -job $j} -ArgumentList $j </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to get the results of background jobs run on three remote computers. The first command uses the New-PSSession cmdlet to create three PSSessions, one on each of the servers specified in the command. It saves the PSSessions in the $s variable. The second command uses the Invoke-Command cmdlet to run a Start-Job command in each of the PSSessions in the $s variable. The job runs a Get-Eventlog command that gets the events in the System log. The command saves the results in the $j variable. Because the command used Invoke-Command to run the Start-Job command, the command actually started three independent jobs on each of the three computers. As a result, the command returned three job objects representing three jobs run locally on three different computers. The third command displays the three job objects in $j. The fourth command uses Invoke-Command to run a Receive-Job command in each of the PSSessions in $s and save the results in the $results variable. Because $j is a local variable, the script block uses the "param" keyword to declare the variables in the command and the ArgumentList parameter to supply the value of $j. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113372</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_Details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Wait-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Register-PSSessionConfiguration </command:name> <maml:description> <maml:para>Creates and registers a new session configuration.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Register</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Register-PSSessionConfiguration cmdlet creates and registers a new session configuration on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. Every Windows PowerShell remote session uses a session configuration. When users create a session that connects to the computer, they can select a configuration or use the default configurations that are registered when you enable Windows PowerShell remoting. Users can also set the $PSSessionConfigurationName preference variable, which specifies a default configuration for sessions created in the current session. The session configuration configures the environment for the session. You can define the configuration by using an assembly that implements a new configuration class and by using a script that runs in the session. The configuration can determine which commands are available in the session, and it can include settings that protect the computer, such as those that limit the amount of data that the session can receive remotely in a single object or command. You can also specify a security descriptor that determines the permissions that are required to use the configuration.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Register-PSSessionConfiguration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>AssemblyName</maml:name> <maml:description> <maml:para>Specifies the name of an assembly file (*.dll) in which the configuration type is defined. You can specify the path to the .dll in this parameter or in the value of the ApplicationBase parameter. This parameter is required when the ConfigurationTypeName parameter is specified. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3"> <maml:name>ConfigurationTypeName</maml:name> <maml:description> <maml:para>Specifies the fully qualified name of the Microsoft .NET Framework type that is used for this configuration. The type that you specify must implement the System.Management.Automation.Remoting.PSSessionConfiguration class. To specify the assembly file (.dll) that implements the configuration type, use the AssemblyName and AssemblyBase parameters. Creating a type allows you to control more aspects of the session configuration, such as exposing or hiding certain parameters of cmdlets, or setting data size and object size limits that users cannot override. If you omit this parameter, the DefaultRemotePowerShellConfiguration class is used for the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationBase</maml:name> <maml:description> <maml:para>Specifies the path to the assembly file (*.dll) that is specified in the value of the AssemblyName parameter. Use this parameter when the value of the AssemblyName parameter does not include a path. The default is the current directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the session configuration. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all users prompts and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommandMB</maml:name> <maml:description> <maml:para>Limits the amount of data that can be sent to this computer in any single remote command. Enter the data size in megabytes (MB). The default is 50 MB. If a data size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSizeMB</maml:name> <maml:description> <maml:para>Limits the amount of data that can be sent to this computer in any single object. Enter the data size in megabytes (MB). The default is 10 MB. If an object size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter a Register-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the new session configuration effective. Until the WinRM service is restarted, the new session configuration is not effective. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProcessorArchitecture</maml:name> <maml:description> <maml:para>Specifies a processor architecture for the configuration. This value determines whether a 32-bit or 64-bit version of the process that hosts Windows PowerShell is started when the configuration is used. Valid values are x86, AMD64, and IA64. The default is determined by the processor architecture of the computer that hosts the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Specifies a Security Descriptor Definition Language (SDDL) string for the configuration. This string determines the permissions that are required to use the new session configuration. To use a session configuration in a session, users must have at least "Execute(Invoke)" permission for the configuration. If the security descriptor is complex, consider using the ShowSecurityDescriptorUI parameter instead of this parameter. You cannot use both parameters in the same command. If you omit this parameter, the root SDDL for the WinRM service is used for this configuration. To view or change the root SDDL, use the WS-Management provider. For example "get-item wsman:\localhost\service\rootSDDL". For more information about the WS-Management provider, type "get-help wsman".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ShowSecurityDescriptorUI</maml:name> <maml:description> <maml:para>Displays a property sheet that helps you to create the SDDL for the session configuration. The property sheet appears after you enter the Register-PSSessionConfiguration command and then restart the WinRM service. When setting the permissions for the configuration, remember that users must have at least "Execute(Invoke)" permission to use the session configuration in a session. You cannot use the SecurityDescriptorSDDL parameter and this parameter in the same command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>StartupScript</maml:name> <maml:description> <maml:para>Specifies the fully qualified path to a Windows PowerShell script. The specified script runs in the new session that uses the session configuration. You can use the script to further configure the session. If the script generates an error (even a non-terminating error), the session is not created and the user's New-PSSession command fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadApartmentState</maml:name> <maml:description> <maml:para>Determines the apartment state of the threads in the session. Valid values are STA, MTA, and Unknown. Unknown is the default.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >STA</command:parameterValue> <command:parameterValue required="false" variableLength="false" >MTA</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Unknown</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadOptions</maml:name> <maml:description> <maml:para>Defines how threads are created and used when a command is executed in the session. Valid values are Default, ReuseThread, UseCurrentThread, and UseNewThread. UseCurrentThread is the default. </maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >UseNewThread</command:parameterValue> <command:parameterValue required="false" variableLength="false" >ReuseThread</command:parameterValue> <command:parameterValue required="false" variableLength="false" >UseCurrentThread</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationBase</maml:name> <maml:description> <maml:para>Specifies the path to the assembly file (*.dll) that is specified in the value of the AssemblyName parameter. Use this parameter when the value of the AssemblyName parameter does not include a path. The default is the current directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Current directory</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>AssemblyName</maml:name> <maml:description> <maml:para>Specifies the name of an assembly file (*.dll) in which the configuration type is defined. You can specify the path to the .dll in this parameter or in the value of the ApplicationBase parameter. This parameter is required when the ConfigurationTypeName parameter is specified. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3"> <maml:name>ConfigurationTypeName</maml:name> <maml:description> <maml:para>Specifies the fully qualified name of the Microsoft .NET Framework type that is used for this configuration. The type that you specify must implement the System.Management.Automation.Remoting.PSSessionConfiguration class. To specify the assembly file (.dll) that implements the configuration type, use the AssemblyName and AssemblyBase parameters. Creating a type allows you to control more aspects of the session configuration, such as exposing or hiding certain parameters of cmdlets, or setting data size and object size limits that users cannot override. If you omit this parameter, the DefaultRemotePowerShellConfiguration class is used for the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>System.Management.Automation.Remoting.PSSessionConfiguration </dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all users prompts and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommandMB</maml:name> <maml:description> <maml:para>Limits the amount of data that can be sent to this computer in any single remote command. Enter the data size in megabytes (MB). The default is 50 MB. If a data size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> <dev:type> <maml:name>double</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>50</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSizeMB</maml:name> <maml:description> <maml:para>Limits the amount of data that can be sent to this computer in any single object. Enter the data size in megabytes (MB). The default is 10 MB. If an object size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> <dev:type> <maml:name>double</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>10</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the session configuration. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter a Register-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the new session configuration effective. Until the WinRM service is restarted, the new session configuration is not effective. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ProcessorArchitecture</maml:name> <maml:description> <maml:para>Specifies a processor architecture for the configuration. This value determines whether a 32-bit or 64-bit version of the process that hosts Windows PowerShell is started when the configuration is used. Valid values are x86, AMD64, and IA64. The default is determined by the processor architecture of the computer that hosts the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>The processor architecture of the host computer.</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Specifies a Security Descriptor Definition Language (SDDL) string for the configuration. This string determines the permissions that are required to use the new session configuration. To use a session configuration in a session, users must have at least "Execute(Invoke)" permission for the configuration. If the security descriptor is complex, consider using the ShowSecurityDescriptorUI parameter instead of this parameter. You cannot use both parameters in the same command. If you omit this parameter, the root SDDL for the WinRM service is used for this configuration. To view or change the root SDDL, use the WS-Management provider. For example "get-item wsman:\localhost\service\rootSDDL". For more information about the WS-Management provider, type "get-help wsman".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>The value of the root SDDL</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ShowSecurityDescriptorUI</maml:name> <maml:description> <maml:para>Displays a property sheet that helps you to create the SDDL for the session configuration. The property sheet appears after you enter the Register-PSSessionConfiguration command and then restart the WinRM service. When setting the permissions for the configuration, remember that users must have at least "Execute(Invoke)" permission to use the session configuration in a session. You cannot use the SecurityDescriptorSDDL parameter and this parameter in the same command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>StartupScript</maml:name> <maml:description> <maml:para>Specifies the fully qualified path to a Windows PowerShell script. The specified script runs in the new session that uses the session configuration. You can use the script to further configure the session. If the script generates an error (even a non-terminating error), the session is not created and the user's New-PSSession command fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadApartmentState</maml:name> <maml:description> <maml:para>Determines the apartment state of the threads in the session. Valid values are STA, MTA, and Unknown. Unknown is the default.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ApartmentState</command:parameterValue> <dev:type> <maml:name>ApartmentState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Unknown</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadOptions</maml:name> <maml:description> <maml:para>Defines how threads are created and used when a command is executed in the session. Valid values are Default, ReuseThread, UseCurrentThread, and UseNewThread. UseCurrentThread is the default. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSThreadOptions</command:parameterValue> <dev:type> <maml:name>PSThreadOptions</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>UseCurrentThread</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.WSMan.Management.WSManConfigContainerElement</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option. This cmdlet generates XML that represents a Web Services for Management (WS-Management) plug-in configuration and sends the XML to WS-Management, which registers the plug-in on the local computer ("new-item wsman:\localhost\plugin"). </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> register-pssessionConfiguration -name NewShell -applicationBase c:\MyShells\ -assemblyName MyShell.dll -configurationTypeName MyClass </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command registers the NewShell session configuration. It uses the ApplicationName and ApplicationBase parameters to specify the location of the MyShell.dll file, which specifies the cmdlets and providers in the session configuration. It also uses the ConfigurationTypeName parameter to specify a new class that further configures the session. To use this configuration, users would type "new-pssession -configurationname newshell".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> register-pssessionConfiguration -name MaintenanceShell -startupScript c:\ps-test\Maintenance.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command registers the MaintenanceShell configuration on the local computer. The command uses the StartupScript parameter to specify the Maintenance.ps1 script. When a user uses a New-PSSession command and selects the MaintenanceShell configuration, the Maintenance.ps1 script runs in the new session. The script can configure the session, including importing modules, adding Windows PowerShell snap-ins, and setting the execution policy for the session. If the script generates any errors, including non-terminating errors, the New-PSSession command fails. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $sddl = "O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;FA;SA;GWGX;;WD)" C:\PS> register-pssessionconfiguration -name AdminShell -securityDescriptorSDDL $sddl -maximumReceivedObjectSizeMB 20 -startupScript c:\scripts\AdminShell.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example registers the AdminShell session configuration. The first command saves a custom SDDL in the $sddl variable. The second command registers the new shell. The command uses the SecurityDescritorSDDL parameter to specify the SDDL in the value of the $sddl variable and the MaximumReceivedObjectSizeMB parameter to increase the object size limit. It also uses the StartupScript parameter to specify a script that configures the session. As an alternative to using the SecurityDescriptorSDDL parameter, you can use the ShowSecurityDescriptorUI parameter, which displays a property sheet that you can use to set permissions for the session configuration. When you click "OK" in the property sheet, the tool generates an SDDL for the session configuration.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = register-pssessionConfiguration -name MaintenanceShell -startupScript c:\ps-test\Maintenance.ps1 C:\PS> $s WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin Name Type Keys ---- ---- ---- MaintenanceShell Container {Name=MaintenanceShell} C:\PS> $s.getType().fullname TypeName: Microsoft.WSMan.Management.WSManConfigContainerElement C:\PS> $s | format-list -property * PSPath : Microsoft.WSMan.Management\WSMan::localhost\Plugin\MaintenanceShell PSParentPath : Microsoft.WSMan.Management\WSMan::localhost\Plugin PSChildName : MaintenanceShell PSDrive : WSMan PSProvider : Microsoft.WSMan.Management\WSMan PSIsContainer : True Keys : {Name=MaintenanceShell} Name : MaintenanceShell TypeNameOfElement : Container C:\PS> dir wsman:\localhost\plugin Name Type Keys ---- ---- ---- MaintenanceShell Container {Name=MaintenanceShell} microsoft.powershell Container {Name=microsoft.powershell} microsoft.powershell32 Container {Name=microsoft.powershell32} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows that a Register-PSSessionConfiguration command returns a WSManConfigContainerElement. It also shows how to find the container elements in the WSMan: drive. The first command uses the Register-PSSessionConfiguration cmdlet to register the MaintenanceShell configuration. It saves the object that the cmdlet returns in the $s variable. The second command displays the contents of the $s variable. The third command uses the GetType method and its FullName property to display the type name of the object that Register-PSSessionConfiguration returns. The fourth command uses the Format-List cmdlet to display all the properties of the object that Register-PSSessionConfiguration returns in a list. The PSPath property shows that the object is stored in a directory of the WSMan: drive. The fifth command uses the Get-ChildItem cmdlet to display the items in the WSMan:\LocalHost\PlugIn path. These include the new MaintenanceShell configuration and the two default configurations that come with Windows PowerShell.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> register-pssessionconfiguration -name WithProfile -startupScript add-profile.ps1 # Add-Profile.ps1 . c:\users\admin01\documents\windowspowershell\profile.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command creates and registers the WithProfile session configuration on the local computer. The command uses the StartupScript parameter to direct Windows PowerShell to run the specified script in any session that uses the session configuration. The content of the specified script, Add-Profile.ps1, is also displayed. The script contains a single command that uses dot sourcing to run the user's CurrentUserAllHosts profile in the current scope of the session. For more information about profiles, see about_Profiles. For more information about dot sourcing, see about_Scopes.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144306</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Remove-Job </command:name> <maml:description> <maml:para>Deletes a Windows PowerShell background job.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Remove</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Remove-Job cmdlet deletes Windows PowerShell background jobs that were started by using Start-Job or the AsJob parameter of any cmdlet. You can use this cmdlet to delete all jobs or delete selected jobs based on their name, ID, instance ID, command, or state, or by passing a job object to Remove-Job. Without parameters or parameter values, Remove-Job has no effect. Before deleting a running job, use the Stop-Job cmdlet to stop the job. If you try to delete a running job, the command fails. You can use the Force parameter of Remove-Job to delete a running job. If you do not delete a background job, the job remains in the global job cache until you close the session in which the job was created.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Deletes background jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Deletes the job even if the status is "Running". Without the Force parameter, Remove-Job will not delete a running job.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Command</maml:name> <maml:description> <maml:para>Removes jobs that include the specified words in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Deletes jobs with the specified instance IDs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job or display the job object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Deletes the job even if the status is "Running". Without the Force parameter, Remove-Job will not delete a running job.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the jobs to be deleted. Enter a variable that contains the jobs or a command that gets the jobs. You can also use a pipeline operator to submit jobs to the Remove-Job cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Deletes the job even if the status is "Running". Without the Force parameter, Remove-Job will not delete a running job.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Deletes only the jobs with the specified friendly names. Wildcards are permitted. Because the friendly name is not guaranteed to be unique, even within the session, use the WhatIf and Confirm parameters when deleting jobs by name. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Deletes the job even if the status is "Running". Without the Force parameter, Remove-Job will not delete a running job.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Job</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Deletes only jobs with the specified status. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked. To delete jobs with a status of Running, use the Force parameter.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >NotStarted</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Running</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Completed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Failed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Stopped</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Blocked</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Command</maml:name> <maml:description> <maml:para>Removes jobs that include the specified words in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Deletes the job even if the status is "Running". Without the Force parameter, Remove-Job will not delete a running job.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Deletes background jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the instance ID, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Deletes jobs with the specified instance IDs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job or display the job object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the jobs to be deleted. Enter a variable that contains the jobs or a command that gets the jobs. You can also use a pipeline operator to submit jobs to the Remove-Job cmdlet. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> <dev:type> <maml:name>Job[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Deletes only the jobs with the specified friendly names. Wildcards are permitted. Because the friendly name is not guaranteed to be unique, even within the session, use the WhatIf and Confirm parameters when deleting jobs by name. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Deletes only jobs with the specified status. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked. To delete jobs with a status of Running, use the Force parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobState</command:parameterValue> <dev:type> <maml:name>JobState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.Job</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a job object to Remove-Job. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $batch = get-job -name BatchJob C:\PS> $batch | remove-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands delete a background job named BatchJob from the current session. The first command uses the Get-Job cmdlet to get an object representing the job, and then it saves the job in the $batch variable. The second command uses a pipeline operator (|) to send the job to the Remove-Job cmdlet. This command is equivalent to using the Job parameter of Remove-Job, for example, "remove-job -job $batch".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job | remove-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command deletes all of the jobs in the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-job -state NotStarted </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command deletes all jobs from the current session that have not yet been started.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-job -name *batch -force </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command deletes all jobs with friendly names that end with "batch" from the current session, including jobs that are running. It uses the Name parameter of Remove-Job to specify a job name pattern, and it uses the Force parameter to ensure that all jobs are removed, even those that might be in progress.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = invoke-command -computername Server01 -scriptblock {get-process} -asJob C:\PS> $j | remove-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Remove-Job cmdlet to remove a job that was started on a remote computer by using the AsJob parameter of the Invoke-Command cmdlet. The first command uses the Invoke-Command cmdlet to run a job on the Server01 computer. It uses the AsJob parameter to run the command as a background job, and it saves the resulting job object in the $j variable. Because the command used the AsJob parameter, the job object is created on the local computer, even though the job runs on a remote computer. As a result, you use local commands to manage the job. The second command uses the Remove-Job cmdlet to remove the job. It uses a pipeline operator (|) to send the job in $j to Remove-Job. Note that this is a local command. A remote command is not required to remove a job that was started by using the AsJob parameter. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01 C:\PS> invoke-command -session $s -scriptblock {start-job -scriptblock {get-process} -name MyJob} C:\PS> invoke-command -session $s -scriptblock {remove-job -name MyJob} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to remove a job that was started by using Invoke-Command to run a Start-Job command. In this case, the job object is created on the remote computer and you use remote commands to manage the job. The first command uses the New-PSSession cmdlet to create a PSSession (a persistent connection) to the Server01 computer. A persistent connection is required when running a Start-Job command remotely. The command saves the PSSession in the $s variable. The second command uses the Invoke-Command cmdlet to run a Start-Job command in the PSSession in $s. The job runs a Get-Process command. It uses the Name parameter of Start-Job to specify a friendly name for the job. The third command uses the Invoke-Command cmdlet to run a Remove-Job command in the PSSession in $s. The command uses the Name parameter of Remove-Job to identify the job to be deleted.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = start-job -script {get-process powershell} C:\PS> $j | format-list -property * C:\PS> remove-job -instanceID dce2ee73-f8c9-483e-bdd7-a549d8687eed C:\PS> $j = start-job -script {get-process powershell} C:\PS> $j | format-list -property * HasMoreData : False StatusMessage : Location : localhost Command : get-process powershell JobStateInfo : Failed Finished : System.Threading.ManualResetEvent InstanceId : dce2ee73-f8c9-483e-bdd7-a549d8687eed Id : 1 Name : Job1 ChildJobs : {Job2} Output : {} Error : {} Progress : {} Verbose : {} Debug : {} Warning : {} StateChanged : C:\PS> remove-job -instanceID dce2ee73-f8c9-483e-bdd7-a549d8687eed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to remove a job based on its instance ID. The first command uses the Start-Job cmdlet to start a background job. The command saves the resulting job object in the $j variable. The second command uses a pipeline operator (|) to send the job object in $j to a Format-List command. The Format-List command uses the Property parameter with a value of * (all) to display all of the properties of the job object in a list. The job object display shows the values of the ID and InstanceID properties, along with the other properties of the object. The third command uses a Remove-Job command to remove the job from the current session. To generate the command, you can copy and paste the InstanceID value from the object display. To copy a value in the Windows PowerShell console, use the mouse to select the value, and then press Enter to copy it. To paste a value, right-click.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113377</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_Details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Receive-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Wait-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Remove-Module </command:name> <maml:description> <maml:para>Removes modules from the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Remove</command:verb> <command:noun>Module</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Remove-Module cmdlet removes the members of a module from the current session. If the module includes an assembly (.dll), all members that are implemented by the assembly are removed, but the assembly is not unloaded.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Remove-Module</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>ModuleInfo</maml:name> <maml:description> <maml:para>Specifies the module objects to remove. Enter a variable that contains a module object (PSModuleInfo) or a command that gets a module object, such as a Get-Module command. You can also pipe module objects to Remove-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSModuleInfo[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Removes modules even when their access mode is read-only.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-Module</maml:name> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of modules to remove. Wildcards are permitted. You can also pipe name strings to Remove-Module. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Removes modules even when their access mode is read-only.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Removes modules even when their access mode is read-only.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1"> <maml:name>ModuleInfo</maml:name> <maml:description> <maml:para>Specifies the module objects to remove. Enter a variable that contains a module object (PSModuleInfo) or a command that gets a module object, such as a Get-Module command. You can also pipe module objects to Remove-Module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSModuleInfo[]</command:parameterValue> <dev:type> <maml:name>PSModuleInfo[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="true (ByValue)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of modules to remove. Wildcards are permitted. You can also pipe name strings to Remove-Module. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String, System.Management.Automation.PSModuleInfo</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe module names (strings) and module objects to Remove-Module. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Remove-Module does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can also refer to Remove-Module by its alias, "rmo". For more information, see about_Aliases. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-module -name BitsTransfer </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes the BitsTransfer module from the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-module | remove-module </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes all modules from the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> "FileTransfer", "PSDiagnostics" | remove-module -verbose VERBOSE: Performing operation "Remove-Module" on Target "filetransfer (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\f iletransfer\filetransfer.psd1')". VERBOSE: Performing operation "Remove-Module" on Target "Microsoft.BackgroundIntelligentTransfer.Management (Path: 'C:\Windows\ assembly\GAC_MSIL\Microsoft.BackgroundIntelligentTransfer.Management\1.0.0.0__31bf3856ad364e35\Microsoft.BackgroundIntelligentTransfe r.Management.dll')". VERBOSE: Performing operation "Remove-Module" on Target "psdiagnostics (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ psdiagnostics\psdiagnostics.psd1')". VERBOSE: Removing imported function 'Start-Trace'. VERBOSE: Removing imported function 'Stop-Trace'. VERBOSE: Removing imported function 'Enable-WSManTrace'. VERBOSE: Removing imported function 'Disable-WSManTrace'. VERBOSE: Removing imported function 'Enable-PSWSManCombinedTrace'. VERBOSE: Removing imported function 'Disable-PSWSManCombinedTrace'. VERBOSE: Removing imported function 'Set-LogProperties'. VERBOSE: Removing imported function 'Get-LogProperties'. VERBOSE: Removing imported function 'Enable-PSTrace'. VERBOSE: Removing imported function 'Disable-PSTrace'. VERBOSE: Performing operation "Remove-Module" on Target "PSDiagnostics (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ psdiagnostics\PSDiagnostics.psm1')". </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes the FileTransfer and PSDiagnostics modules from the current session. The command uses a pipeline operator (|) to send the module names to Remove-Module. It uses the Verbose common parameter to get detailed information about the members that are removed. The Verbose messages show the items that are removed. The messages differ because the BitsTransfer module includes an assembly that implements its cmdlets and a nested module with its own assembly. The PSDiagnostics module includes a module script file (.psm1) that exports functions.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $a = get-module BitsTransfer C:\PS> remove-module -moduleInfo $a </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the ModuleInfo parameter to remove the BitsTransfer module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141556</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Remove-PSSession </command:name> <maml:description> <maml:para>Closes one or more Windows PowerShell sessions (PSSessions).</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Remove</command:verb> <command:noun>PSSession</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Remove-PSSession cmdlet closes Windows PowerShell sessions (PSSessions) in the current session. It stops any commands that are running in the PSSessions, ends the PSSession, and releases the resources that the PSSession was using. If the PSSession is connected to a remote computer, Remove-PSSession also closes the connection between the local and remote computers. To remove a PSSession, enter the Name, ComputerName, ID, or InstanceID of the session. If you have saved the PSSession in a variable, the session object remains in the variable, but the state of the PSSession is "Closed."</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Remove-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Closes the PSSessions that are connected to the specified computers. Wildcards are permitted. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. To specify the local computer, type the computer name, "localhost", or a dot (.).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-PSSession</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified IDs. Type one or more IDs (separated by commas) or use the range operator (..) to specify a range of IDs An ID is an integer that uniquely identifies the PSSession in the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. To find the ID of a PSSession, use Get-PSSession without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified instance IDs. The instance ID is a GUID that uniquely identifies a PSSession in the current session. The InstanceID is unique, even when you have multiple sessions running on a single computer. The InstanceID is stored in the InstanceID property of the object that represents a PSSession. To find the InstanceID of the PSSessions in the current session, type "get-pssession | format-table Name, ComputerName, InstanceId". </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-PSSession</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified friendly names. Wildcards are permitted. Because the friendly name of a PSSession might not be unique, when using the Name parameter, consider also using the WhatIf or Confirm parameter in the Remove-PSSession command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-PSSession</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Specifies the session objects of the PSSessions to close. Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. You can also pipe one or more session objects to Remove-PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>ComputerName</maml:name> <maml:description> <maml:para>Closes the PSSessions that are connected to the specified computers. Wildcards are permitted. Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. To specify the local computer, type the computer name, "localhost", or a dot (.).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified IDs. Type one or more IDs (separated by commas) or use the range operator (..) to specify a range of IDs An ID is an integer that uniquely identifies the PSSession in the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. To find the ID of a PSSession, use Get-PSSession without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified instance IDs. The instance ID is a GUID that uniquely identifies a PSSession in the current session. The InstanceID is unique, even when you have multiple sessions running on a single computer. The InstanceID is stored in the InstanceID property of the object that represents a PSSession. To find the InstanceID of the PSSessions in the current session, type "get-pssession | format-table Name, ComputerName, InstanceId". </maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Closes the PSSessions with the specified friendly names. Wildcards are permitted. Because the friendly name of a PSSession might not be unique, when using the Name parameter, consider also using the WhatIf or Confirm parameter in the Remove-PSSession command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Session</maml:name> <maml:description> <maml:para>Specifies the session objects of the PSSessions to close. Enter a variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command. You can also pipe one or more session objects to Remove-PSSession.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">PSSession[]</command:parameterValue> <dev:type> <maml:name>PSSession[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.Runspaces.PSSession </maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a session object to Remove-PSSession. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Remove-PSSession does not return any objects. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> The ID parameter is mandatory. You cannot type "remove-pssession" without parameters. To delete all the PSSessions in the current session, type "get-pssession | remove-pssession". A PSSession uses a persistent connection to a remote computer. Create a PSSession to run a series of commands that share data. For more information, see about_PSSessions. PSSessions are specific to the current session. When you end a session, the PSSessions that you created in that session are forcibly closed. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-pssession -id 1, 2 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes the PSSessions that have IDs 1 and 2.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession | remove-pssession C:\PS> remove-pssession -session (get-pssession) C:\PS> $s = get-pssession C:\PS> remove-pssession -session $s". </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands remove all of the PSSessions in the current session. Although the three command formats look different, they have the same effect.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $r = get-pssession -computername Serv* $r | remove-pssession </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands close the PSSessions that are connected to computers that have names that begin with "Serv".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession | where {$_.port -eq 90} | remove-pssession </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command closes the PSSessions that are connected to port 90. You can use this command format to identify PSSessions by properties other than ComputerName, Name, InstanceID, and ID.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-pssession | ft computername, instanceID -auto ComputerName InstanceId ------------ ---------------- Server01 875d231b-2788-4f36-9f67-2e50d63bb82a localhost c065ffa0-02c4-406e-84a3-dacb0d677868 Server02 4699cdbc-61d5-4e0d-b916-84f82ebede1f Server03 4e5a3245-4c63-43e4-88d0-a7798bfc2414 TX-TEST-01 fc4e9dfa-f246-452d-9fa3-1adbdd64ae85 C:\PS> remove-pssession -InstanceID fc4e9dfa-f246-452d-9fa3-1adbdd64ae85 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands show how to close a PSSession based on its instance ID (RemoteRunspaceID). The first command uses the Get-PSsession cmdlet to get the PSSessions in the current session. It uses a pipeline operator (|) to send the PSSessions to the Format-Table cmdlet (alias: ft), which formats their ComputerName and InstanceID properties in a table. The AutoSize parameter ("auto") compresses the columns for display. From the resulting display, the administrator can identify the PSSession to be closed, and copy and paste the InstanceID of that PSSession into the second command. The second command uses the Remove-PSSession cmdlet to remove the PSSession with the specified instance ID.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> function EndPSS { get-pssession | remove-pssession } </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This function deletes all of the PSSessions in the current session. After you add this function to your Windows Powershell profile, to delete all sessions, just type "endpss".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=135250</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_PSSessions</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enter-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Exit-PSSession</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Remove-PSSnapin </command:name> <maml:description> <maml:para>Removes Windows PowerShell snap-ins from the current session.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Remove</command:verb> <command:noun>PSSnapin</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Remove-PSSnapin cmdlet removes a Windows PowerShell snap-in from the current session. You can use it to remove snap-ins that you have added to Windows PowerShell, but you cannot use it to remove the snap-ins that are installed with Windows PowerShell. After a snap-in is removed from the current session, it is still loaded, but the cmdlets and providers in the snap-in are no longer available in the session.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Remove-PSSnapin</maml:name> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of Windows PowerShell snap-ins to remove from the current session. The parameter name ("Name") is optional, and wildcard characters (*) are permitted in the value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the snap-in. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of Windows PowerShell snap-ins to remove from the current session. The parameter name ("Name") is optional, and wildcard characters (*) are permitted in the value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the snap-in. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSSnapInInfo</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a snap-in object to Remove-PSSnapin. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or System.Management.Automation.PSSnapInInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> By default, Remove-PsSnapin does not generate any output. However, if you use the PassThru parameter, it generates a System.Management.Automation.PSSnapInInfo object representing the snap-in. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> You can also refer to Remove-PSSnapin by its built-in alias, "rsnp". For more information, see about_Aliases. Remove-PSSnapin does not check the version of Windows PowerShell before removing a snap-in from the session. If a snap-in cannot be removed, a warning appears and the command fails. Remove-PSSnapin affects only the current session. If you have added an Add-PSSnapin command to your Windows PowerShell profile, you should delete the command to remove the snap-in from future sessions. For instructions, see about_Profiles. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-pssnapin -name Microsoft.Exchange </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes the Microsoft.Exchange snap-in from the current session. When the command is complete, the cmdlets and providers that the snap-in supported are not available in the session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-PSSnapIn smp* | remove-PSSnapIn </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes the Windows PowerShell snap-ins that have names beginning with "smp" from the current session. The command uses the Get-PSSnapin cmdlet to get objects representing the snap-ins. The pipeline operator (|) sends the results to the Remove-PSSnapin cmdlet, which removes them from the session. The providers and cmdlets that this snap-in supports are no longer available in the session. When you pipe objects to Remove-PSSnapin, the names of the objects are associated with the Name parameter, which accepts objects from the pipeline that have a Name property.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> remove-pssnapin -name *event* </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command removes all Windows PowerShell snap-ins that have names that include "event". This command specifies the "Name" parameter name, but the parameter name can be omitted because it is optional.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113378</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSnapin</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Profiles</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Set-PSDebug </command:name> <maml:description> <maml:para>Turns script debugging features on and off, sets the trace level, and toggles strict mode.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Set</command:verb> <command:noun>PSDebug</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Set-PSDebug cmdlet turns script debugging features on and off, sets the trace level, and toggles strict mode. When the Trace parameter is set to 1, each line of script is traced as it is executed. When the parameter is set to 2, variable assignments, function calls, and script calls are also traced. If the Step parameter is specified, you are prompted before each line of the script is executed.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Set-PSDebug</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Off</maml:name> <maml:description> <maml:para>Turns off all script debugging features. Note: A "set-strictmode -off" command disables the verification set by a "set-psdebug -strict" command. For more information, see Set-StrictMode.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-PSDebug</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Step</maml:name> <maml:description> <maml:para>Turns on script stepping. Before each line is run, the user is prompted to stop, continue, or enter a new interpreter level to inspect the state of the script. Note: Specifying the Step parameter automatically sets a Trace level of 1.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Strict</maml:name> <maml:description> <maml:para>Specifies that the interpreter should throw an exception if a variable is referenced before a value is assigned to the variable. Note: A "set-strictmode -off" command disables the verification set by a "set-psdebug -strict" command. For more information, see Set-StrictMode.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Trace</maml:name> <maml:description> <maml:para>Specifies the trace level: 0 - Turn script tracing off 1 - Trace script lines as they are executed 2 - Trace script lines, variable assignments, function calls, and scripts.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Off</maml:name> <maml:description> <maml:para>Turns off all script debugging features. Note: A "set-strictmode -off" command disables the verification set by a "set-psdebug -strict" command. For more information, see Set-StrictMode.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Step</maml:name> <maml:description> <maml:para>Turns on script stepping. Before each line is run, the user is prompted to stop, continue, or enter a new interpreter level to inspect the state of the script. Note: Specifying the Step parameter automatically sets a Trace level of 1.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Strict</maml:name> <maml:description> <maml:para>Specifies that the interpreter should throw an exception if a variable is referenced before a value is assigned to the variable. Note: A "set-strictmode -off" command disables the verification set by a "set-psdebug -strict" command. For more information, see Set-StrictMode.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Trace</maml:name> <maml:description> <maml:para>Specifies the trace level: 0 - Turn script tracing off 1 - Trace script lines as they are executed 2 - Trace script lines, variable assignments, function calls, and scripts.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-psdebug -trace 2; foreach ($i in 1..3) {$i} DEBUG: 1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i} DEBUG: 1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i} 1 DEBUG: 1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i} 2 DEBUG: 1+ Set-PsDebug -trace 2; foreach ($i in 1..3) {$i} 3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command sets the trace level to 2, and then runs a script that displays the numbers 1, 2, and 3.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-psdebug -step; foreach ($i in 1..3) {$i} DEBUG: 1+ Set-PsDebug -step; foreach ($i in 1..3) {$i} Continue with this operation? 1+ Set-PsDebug -step; foreach ($i in 1..3) {$i} [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):a DEBUG: 1+ Set-PsDebug -step; foreach ($i in 1..3) {$i} 1 2 3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command turns on stepping and then runs a script that displays the numbers 1, 2, and 3.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-psdebug -off; foreach ($i in 1..3) {$i} 1 2 3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command turns off all debugging features, and then runs a script that displays the numbers 1, 2, and 3.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-psdebug -strict; $NewVar The variable $NewVar cannot be retrieved because it has not been set yet. At line:1 char:28 + Set-PsDebug -strict;$NewVar <<<< </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command puts the interpreter in strict mode, and attempts to access a variable that has not yet been set.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113398</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Debuggers</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Debug-Process</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSBreakpoint</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-StrictMode</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Write-Debug</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Set-PSSessionConfiguration </command:name> <maml:description> <maml:para>Changes the properties of a registered session configuration.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Set</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Set-PSSessionConfiguration cmdlet changes the properties of the registered session configurations on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. Use the Name parameter to identify the configuration that you want to change. Use the other parameters to specify new values for the properties of the session configuration. To delete a property value from the configuration (and use the default value), enter an empty string ("") or a value of $null for the corresponding parameter. To see the properties of a session configuration, use the Get-PSSessionConfiguration cmdlet or the WS-Management Provider. For more information about the WS-Management Provider, type "get-help wsman".</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Set-PSSessionConfiguration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>AssemblyName</maml:name> <maml:description> <maml:para>Specifies a different assembly file for the configuration. Enter the path (optional) and file name of an assembly (.dll) file that defines the configuration type. If you enter only the name, you can enter the path in the value of the ApplicationBase parameter. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3"> <maml:name>ConfigurationTypeName</maml:name> <maml:description> <maml:para>Specifies a different configuration type for the configuration. The type that you specify must implement the System.Management.Automation.Remoting.PSSessionConfiguration class. If you enter "$null" or an empty string, the DefaultRemotePowerShellConfiguration class is used for the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the session configuration that you want to change. You cannot use this parameter to change the name of the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationBase</maml:name> <maml:description> <maml:para>Changes the path to the assembly file (*.dll) that is specified in the value of the AssemblyName parameter. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommandMB</maml:name> <maml:description> <maml:para>Changes the limit on the amount of data that can be sent to this computer in any single remote command. Enter the data size in megabytes (MB). The default is 50 MB. If a data size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSizeMB</maml:name> <maml:description> <maml:para>Changes the limits on the amount of data that can be sent to this computer in any single object. Enter the data size in megabytes (MB). The default is 10 MB. If an object size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter a Set-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the new session configuration effective. Until the WinRM service is restarted, the new session configuration is not effective. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Specifies a different Security Descriptor Definition Language (SDDL) string for the configuration. This string determines the permissions that are required to use the new session configuration. To use a session configuration in a session, users must have at least "Execute(Invoke)" permission for the configuration. To use the default security descriptor for the configuration, enter an empty string ("") or a value of $null. The default is the root SDDL in the WSMan: drive. If the security descriptor is complex, consider using the ShowSecurityDescriptorUI parameter instead of this one. You cannot use both parameters in the same command. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ShowSecurityDescriptorUI</maml:name> <maml:description> <maml:para>Displays a property sheet that helps you to create a new SDDL for the session configuration. The property sheet appears after you enter the Set-PSSessionConfiguration command and then restart the WinRM service. When setting the permissions to the configuration, remember that users must have at least "Execute(Invoke)" permission to use the session configuration in a session. You cannot use the SecurityDescriptorSDDL parameter and this parameter in the same command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>StartupScript</maml:name> <maml:description> <maml:para>Adds or changes the startup script for the configuration. Enter the fully qualified path to a Windows PowerShell script. The specified script runs in the new session that uses the session configuration. To delete a startup script from a session configuration, enter an empty string ("") or a value of $null. You can use a startup script to further configure the user's session. If the script generates an error (even a non-terminating error), the session is not created and the user's New-PSSession command fails. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadApartmentState</maml:name> <maml:description> <maml:para>Changes the apartment state setting for the threads in the session. Valid values are STA, MTA and Unknown. Unknown is the default.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >STA</command:parameterValue> <command:parameterValue required="false" variableLength="false" >MTA</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Unknown</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadOptions</maml:name> <maml:description> <maml:para>Changes the thread options setting in the configuration. This setting defines how threads are created and used when a command is executed in the session. Valid values are Default, ReuseThread, UseCurrentThread, and UseNewThread. UseCurrentThread is the default. </maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >UseNewThread</command:parameterValue> <command:parameterValue required="false" variableLength="false" >ReuseThread</command:parameterValue> <command:parameterValue required="false" variableLength="false" >UseCurrentThread</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ApplicationBase</maml:name> <maml:description> <maml:para>Changes the path to the assembly file (*.dll) that is specified in the value of the AssemblyName parameter. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>AssemblyName</maml:name> <maml:description> <maml:para>Specifies a different assembly file for the configuration. Enter the path (optional) and file name of an assembly (.dll) file that defines the configuration type. If you enter only the name, you can enter the path in the value of the ApplicationBase parameter. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="3"> <maml:name>ConfigurationTypeName</maml:name> <maml:description> <maml:para>Specifies a different configuration type for the configuration. The type that you specify must implement the System.Management.Automation.Remoting.PSSessionConfiguration class. If you enter "$null" or an empty string, the DefaultRemotePowerShellConfiguration class is used for the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedDataSizePerCommandMB</maml:name> <maml:description> <maml:para>Changes the limit on the amount of data that can be sent to this computer in any single remote command. Enter the data size in megabytes (MB). The default is 50 MB. If a data size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> <dev:type> <maml:name>double</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>50</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>MaximumReceivedObjectSizeMB</maml:name> <maml:description> <maml:para>Changes the limits on the amount of data that can be sent to this computer in any single object. Enter the data size in megabytes (MB). The default is 10 MB. If an object size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">double</command:parameterValue> <dev:type> <maml:name>double</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>10</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the session configuration that you want to change. You cannot use this parameter to change the name of the session configuration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter a Set-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the new session configuration effective. Until the WinRM service is restarted, the new session configuration is not effective. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>SecurityDescriptorSDDL</maml:name> <maml:description> <maml:para>Specifies a different Security Descriptor Definition Language (SDDL) string for the configuration. This string determines the permissions that are required to use the new session configuration. To use a session configuration in a session, users must have at least "Execute(Invoke)" permission for the configuration. To use the default security descriptor for the configuration, enter an empty string ("") or a value of $null. The default is the root SDDL in the WSMan: drive. If the security descriptor is complex, consider using the ShowSecurityDescriptorUI parameter instead of this one. You cannot use both parameters in the same command. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ShowSecurityDescriptorUI</maml:name> <maml:description> <maml:para>Displays a property sheet that helps you to create a new SDDL for the session configuration. The property sheet appears after you enter the Set-PSSessionConfiguration command and then restart the WinRM service. When setting the permissions to the configuration, remember that users must have at least "Execute(Invoke)" permission to use the session configuration in a session. You cannot use the SecurityDescriptorSDDL parameter and this parameter in the same command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>StartupScript</maml:name> <maml:description> <maml:para>Adds or changes the startup script for the configuration. Enter the fully qualified path to a Windows PowerShell script. The specified script runs in the new session that uses the session configuration. To delete a startup script from a session configuration, enter an empty string ("") or a value of $null. You can use a startup script to further configure the user's session. If the script generates an error (even a non-terminating error), the session is not created and the user's New-PSSession command fails. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadApartmentState</maml:name> <maml:description> <maml:para>Changes the apartment state setting for the threads in the session. Valid values are STA, MTA and Unknown. Unknown is the default.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ApartmentState</command:parameterValue> <dev:type> <maml:name>ApartmentState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>ApartmentState.Unknown</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>ThreadOptions</maml:name> <maml:description> <maml:para>Changes the thread options setting in the configuration. This setting defines how threads are created and used when a command is executed in the session. Valid values are Default, ReuseThread, UseCurrentThread, and UseNewThread. UseCurrentThread is the default. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSThreadOptions</command:parameterValue> <dev:type> <maml:name>PSThreadOptions</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>PSThreadOptions.UserCurrentThread</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.WSMan.Management.WSManConfigLeafElement</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must open Windows PowerShell with the "Run as administrator" option. The Set-PSSessionConfiguration cmdlet does not change the configuration name and the WS-Management provider does not support the Rename-Item cmdlet. To change the name of a configuration, use the Unregister-PSSessionConfiguration cmdlet to delete the configuration and then use the Register-PSSessionConfiguration cmdlet to create and register a new session configuration. You can use the Set-PSSessionConfiguration cmdlet to change the default Microsoft.PowerShell and Microsoft.PowerShell32 session configurations. They are not protected. To revert to the original version of a default session configuration, use the Unregister-PSSessionConfiguration cmdlet to delete the default session configuration and then use the Enable-PSRemoting cmdlet to restore it. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-pssessionconfiguration -name MaintenanceShell -threadApartmentState STA </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command changes the thread apartment state in the MaintenanceShell configuration to STA. The change is effective when you restart the WinRM service.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> register-pssessionconfiguration -name AdminShell -assemblyName c:\shells\AdminShell.dll -configurationType AdminClass C:\PS> set-pssessionconfiguration -name AdminShell -startupScript AdminConfig.ps1 C:\PS> set-pssessionconfiguration -name AdminShell -startupScript $null </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to create and then change a session configuration. The first command uses the Register-PSSessionConfiguration cmdlet to create the AdminShell configuration. The second command uses the Set-PSSessionConfiguration cmdlet to add the AdminConfig.ps1 script to the configuration. The change is effective when you restart WinRM. The third command removes the AdminConfig.ps1 script from the configuration. It uses the Set-PSSessionConfiguration cmdlet with a value of $null for the StartupScript parameter.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> Set-PSSessionConfiguration -name foo -MaximumReceivedObjectSizeMB 20 WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin\foo\InitializationParameters ParamName ParamValue --------- ---------- psmaximumreceivedobjectsizemb 20 "Restart WinRM service" WinRM service need to be restarted to make the changes effective. Do you want to run the command "restart-service winrm"? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example show sample output from the Set-PSSessionConfiguration cmdlet. The Set-PSSessionConfiguration command in this example increases the value of the MaximumReceivedObjectSizeMB property to 20. The Set-PSSessionConfiguration command returns a Microsoft.WSMan.Management.WSManConfigLeafElement object that shows the parameter name and new value. It also prompts you to restart the WinRM service. The Set-PSSessionConfiguration change is not effective until the WinRM service is restarted.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-pssessionconfiguration -name MaintenanceShell -startupScript c:\ps-test\Maintenance.ps1 WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin\MaintenanceShell\InitializationParameters ParamName ParamValue --------- ---------- startupscript c:\ps-test\Mainte... "Restart WinRM service" WinRM service need to be restarted to make the changes effective. Do you want to run the command "restart-service winrm"? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y C:\PS> get-pssessionConfiguration maintenanceshell | format-list -property * xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration Name : MaintenanceShell Filename : %windir%\system32\pwrshplugin.dll SDKVersion : 1 XmlRenderingType : text lang : en-US PSVersion : 2.0 startupscript : c:\ps-test\Maintenance.ps1 ResourceUri : http://schemas.microsoft.com/powershell/MaintenanceShell SupportsOptions : true ExactMatch : true Capability : {Shell} Permission : C:\PS> dir wsman:\localhost\plugin\MaintenanceShell\InitializationParameters ParamName ParamValue --------- ---------- PSVersion 2.0 startupscript c:\ps-test\Maintenance.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command shows different ways of viewing the results of a Set-PSSessionConfiguration command. The first command uses the Set-PSSessionConfiguration cmdlet to change the startup script in the MaintenanceShell configuration to Maintenance.ps1. The output of this command shows the change and prompts you to restart the WinRM service. The response is "y" (yes). The second command uses the Get-PSSessionConfiguration cmdlet to get the MaintenanceShell session configuration. The command uses a pipeline operator (|) to send the results of the command to the Format-List cmdlet, which displays all of the properties of the session configuration object in a list. The third command uses the WS-Management provider to view the initialization parameters for the MaintenanceShell configuration. The command uses the Get-ChildItem cmdlet (alias = dir) to get the child items in the InitializationParameters node for the MaintenanceShell plug-in. For more information about the WS-Management provider, type "get-help wsman". </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144307</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Unregister-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Set-StrictMode </command:name> <maml:description> <maml:para>Establishes and enforces coding rules in expressions, scripts, and script blocks. </maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Set</command:verb> <command:noun>StrictMode</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Set-StrictMode cmdlet configures strict mode for the current scope (and all child scopes) and turns it on and off. When strict mode is on, Windows PowerShell generates a terminating error when the content of an expression, script, or script block violates basic best-practice coding rules. Use the Version parameter to determine which coding rules are enforced. Unlike the Set-PSDebug cmdlet, Set-StrictMode affects only the current scope and its child scopes, so you can use it in a script or function without affecting the global scope. When Set-StrictMode is off, uninitialized variables (Version 1) are assumed to have a value of 0 (zero) or $null, depending on type. References to non-existent properties return $null, and the results of function syntax that is not valid vary with the error. Unnamed variables are not permitted.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Set-StrictMode</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Off</maml:name> <maml:description> <maml:para>Turns strict mode off. This parameter also turns off "Set-PSDebug -Strict".</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-StrictMode</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the conditions that cause an error in strict mode. This parameter is required. The valid values are "1.0", "2.0", and "Latest". The following list shows the effect of each value. 1.0 -- Prohibits references to uninitialized variables, except for uninitialized variables in strings. 2.0 -- Prohibits references to uninitialized variables (including uninitialized variables in strings). -- Prohibits references to non-existent properties of an object. -- Prohibits function calls that use the syntax for calling methods. -- Prohibits a variable without a name (${}). Latest: --Selects the latest (most strict) version available. Use this value to assure that scripts use the strictest available version, even when new versions are added to Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Off</maml:name> <maml:description> <maml:para>Turns strict mode off. This parameter also turns off "Set-PSDebug -Strict".</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies the conditions that cause an error in strict mode. This parameter is required. The valid values are "1.0", "2.0", and "Latest". The following list shows the effect of each value. 1.0 -- Prohibits references to uninitialized variables, except for uninitialized variables in strings. 2.0 -- Prohibits references to uninitialized variables (including uninitialized variables in strings). -- Prohibits references to non-existent properties of an object. -- Prohibits function calls that use the syntax for calling methods. -- Prohibits a variable without a name (${}). Latest: --Selects the latest (most strict) version available. Use this value to assure that scripts use the strictest available version, even when new versions are added to Windows PowerShell.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Version</command:parameterValue> <dev:type> <maml:name>Version</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You cannot pipe input to this cmdlet. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> Set-StrictMode is similar to the Strict parameter of Set-PSDebug. "Set-Strictmode -version 1" is equivalent to "Set-PSDebug -strict", except that Set-PSDebug is effective in all scopes. Set-StrictMode is effective only in the scope in which it is set and in its child scopes. For more information about scopes in Windows PowerShell, see about_Scopes. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> set-strictmode -version 1.0 C:\PS> $a -gt 5 False The variable $a cannot be retrieved because it has not been set yet. At line:1 char:3 + $a <<<< -gt 5 + CategoryInfo : InvalidOperation: (a:Token) [], RuntimeException + FullyQualifiedErrorId : VariableIsUndefined </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command turns strict mode on and sets it to version 1.0. As a result, attempts to reference variables that are not initialized will fail. The sample output shows the effect of version 1.0 strict mode.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> # set-strictmode -version 2.0 # Strict mode is off by default. C:\PS> function add ($a, $b) {$a + $b} C:\PS> add 3 4 7 C:\PS> add(3,4) 3 4 C:\PS> set-strictmode -version 2.0 C:\PS> add(3,4) The function or command was called like a method. Parameters should be separated by spaces, as described in 'Get-Help about_Parameter.' At line:1 char:4 + add <<<< (3,4) + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : StrictModeFunctionCallWithParens C:\PS> set-strictmode -off C:\PS> $string = "This is a string". C:\PS> $string.Month C:\PS> C:\PS> set-strictmode -version 2.0 C:\PS> $string = "This is a string". C:\PS> $string.Month Property 'month' cannot be found on this object; make sure it exists. At line:1 char:9 + $string. <<<< month + CategoryInfo : InvalidOperation: (.:OperatorToken) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFoundStrict </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command turns strict mode on and sets it to version 2.0. As a result, Windows PowerShell throws an error if you use method syntax (parentheses and commas) for a function call or reference uninitialized variables or non-existent properties. The sample output shows the effect of version 2.0 strict mode. Without version 2.0 strict mode, the "(3,4)" value is interpreted as a single array object to which nothing is added. With version 2.0 strict mode, it is correctly interpreted as faulty syntax for submitting two values. Without version 2.0, the reference to the non-existent Month property of a string returns only null. With version 2.0, it is interpreted correctly as a reference error.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113450</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Debuggers</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Scopes</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSDebug</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Start-Job </command:name> <maml:description> <maml:para>Starts a Windows PowerShell background job.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Start</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Start-Job cmdlet starts a Windows PowerShell background job on the local computer. A Windows PowerShell background job runs a command "in the background" without interacting with the current session. When you start a background job, a job object is returned immediately, even if the job takes an extended time to complete. You can continue to work in the session without interruption while the job runs. The job object contains useful information about the job, but it does not contain the job results. When the job completes, use the Receive-Job cmdlet to get the results of the job. For more information about background jobs, see about_Jobs. To run a background job on a remote computer, use the AsJob parameter that is available on many cmdlets, or use the Invoke-Command cmdlet to run a Start-Job command on the remote computer. For more information, see about_Remote_Jobs.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Start-Job</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run in the background job. Enclose the commands in braces ( { } ) to create a script block. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>InitializationScript</maml:name> <maml:description> <maml:para>Specifies commands that run before the job starts. Enclose the commands in braces ( { } ) to create a script block. Use this parameter to prepare the session in which the job runs. For example, you can use it to add functions, snap-ins, and modules to the session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies the arguments (parameter values) for the script that is specified by the FilePath parameter. Because all of the values that follow the ArgumentList parameter name are interpreted as being values of ArgumentList, the ArgumentList parameter should be the last parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one from the Get-Credential cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects, or type a command or expression that generates the objects. In the value of the ScriptBlock parameter, use the $input automatic variable to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the new job. You can use the name to identify the job to other job cmdlets, such as Stop-Job. The default friendly name is Job#, where "#" is an ordinal number that is incremented for each job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>RunAs32</maml:name> <maml:description> <maml:para>Runs the job in a 32-bit process. Use this parameter to force the job to run in a 32-bit process on a 64-bit operating system.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Start-Job</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script as a background job. Enter the path and file name of the script or pipe a script path to Start-Job. The script must reside on the local computer or in a directory that the local computer can access. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block and runs the script block as a background job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>InitializationScript</maml:name> <maml:description> <maml:para>Specifies commands that run before the job starts. Enclose the commands in braces ( { } ) to create a script block. Use this parameter to prepare the session in which the job runs. For example, you can use it to add functions, snap-ins, and modules to the session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies the arguments (parameter values) for the script that is specified by the FilePath parameter. Because all of the values that follow the ArgumentList parameter name are interpreted as being values of ArgumentList, the ArgumentList parameter should be the last parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >Default</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Basic</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Negotiate</command:parameterValue> <command:parameterValue required="false" variableLength="false" >NegotiateWithImplicitCredential</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Credssp</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Digest</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Kerberos</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one from the Get-Credential cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects, or type a command or expression that generates the objects. In the value of the ScriptBlock parameter, use the $input automatic variable to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the new job. You can use the name to identify the job to other job cmdlets, such as Stop-Job. The default friendly name is Job#, where "#" is an ordinal number that is incremented for each job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>RunAs32</maml:name> <maml:description> <maml:para>Runs the job in a 32-bit process. Use this parameter to force the job to run in a 32-bit process on a 64-bit operating system.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>ArgumentList</maml:name> <maml:description> <maml:para>Specifies the arguments (parameter values) for the script that is specified by the FilePath parameter. Because all of the values that follow the ArgumentList parameter name are interpreted as being values of ArgumentList, the ArgumentList parameter should be the last parameter in the command.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Authentication</maml:name> <maml:description> <maml:para>Specifies the mechanism that is used to authenticate the user's credentials. Valid values are Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The default value is Default. CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows. For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in MSDN. CAUTION: Credential Security Service Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AuthenticationMechanism</command:parameterValue> <dev:type> <maml:name>AuthenticationMechanism</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one from the Get-Credential cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Current user</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>FilePath</maml:name> <maml:description> <maml:para>Runs the specified local script as a background job. Enter the path and file name of the script or pipe a script path to Start-Job. The script must reside on the local computer or in a directory that the local computer can access. When you use this parameter, Windows PowerShell converts the contents of the specified script file to a script block and runs the script block as a background job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="2"> <maml:name>InitializationScript</maml:name> <maml:description> <maml:para>Specifies commands that run before the job starts. Enclose the commands in braces ( { } ) to create a script block. Use this parameter to prepare the session in which the job runs. For example, you can use it to add functions, snap-ins, and modules to the session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies input to the command. Enter a variable that contains the objects, or type a command or expression that generates the objects. In the value of the ScriptBlock parameter, use the $input automatic variable to represent the input objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> <dev:type> <maml:name>psobject</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a friendly name for the new job. You can use the name to identify the job to other job cmdlets, such as Stop-Job. The default friendly name is Job#, where "#" is an ordinal number that is incremented for each job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>Job<number></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>RunAs32</maml:name> <maml:description> <maml:para>Runs the job in a 32-bit process. Use this parameter to force the job to run in a 32-bit process on a 64-bit operating system.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>ScriptBlock</maml:name> <maml:description> <maml:para>Specifies the commands to run in the background job. Enclose the commands in braces ( { } ) to create a script block. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a file path to Start-Job. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.RemotingJob</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Start-Job returns an object that represents the job that it started. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run in the background, Start-Job runs in its own session within the current session. When you use the Invoke-Command cmdlet to run a Start-Job command in a session on a remote computer, Start-Job runs in a session within the remote session. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -scriptblock {get-process} C:\PS> start-job -command "get-process" Id Name State HasMoreData Location Command --- ---- ----- ----------- -------- ------- 1 Job1 Running True localhost get-process </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command starts a background job that runs a Get-Process command. The command returns a job object with information about the job. The command prompt returns immediately so that you can work in the session while the job runs in the background.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $jobWRM = invoke-command -computerName (get-content servers.txt) -scriptblock {get-service winrm} -jobname WinRM -throttlelimit 16 -AsJob </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses the Invoke-Command cmdlet and its AsJob parameter to start a background job that runs a "get-service winrm" command on numerous computers. Because the command is running on a server with substantial network traffic, the command uses the ThrottleLimit parameter of Invoke-Command to limit the number of concurrent commands to 16. The command uses the ComputerName parameter to specify the computers on which the job runs. The value of the ComputerName parameter is a Get-Content command that gets the text in the Servers.txt file, a file of computer names in a domain. The command uses the ScriptBlock parameter to specify the command and the JobName parameter to specify a friendly name for the job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = start-job -scriptblock {get-eventlog -log system} -credential domain01\user01 C:\PS> $j | format-list -property * HasMoreData : True StatusMessage : Location : localhost Command : get-eventlog -log system JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : 2d9d775f-63e0-4d48-b4bc-c05d0e177f34 Id : 1 Name : Job1 ChildJobs : {Job2} Output : {} Error : {} Progress : {} Verbose : {} Debug : {} Warning : {} StateChanged : C:\PS> $j.JobStateInfo.state Completed C:\PS> $results = receive-job -job $j C:\PS> $results Index Time Type Source EventID Message ----- ---- ---- ------ ------- ------- 84366 Feb 18 19:20 Information Service Control M... 7036 The description... 84365 Feb 18 19:16 Information Service Control M... 7036 The description... 84364 Feb 18 19:10 Information Service Control M... 7036 The description... ... </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands manage a background job that gets all of the events from the System log in Event Viewer. The job runs on the local computer. The first command uses the Start-Job cmdlet to start the job. It uses the Credential parameter to specify the user account of a user who has permission to run the job on the computer. Then it saves the job object that Start-Job returns in the $j variable. At this point, you can resume your other work while the job completes. The second command uses a pipeline operator (|) to pass the job object in $j to the Format-List cmdlet. The Format-List command uses the Property parameter with a value of all (*) to display all of the properties of the job object in a list. The third command displays the value of the JobStateInfo property. This contains the status of the job. The fourth command uses the Receive-Job cmdlet to get the results of the job. It stores the results in the $results variable. The final command displays the contents of the $results variable.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -filepath c:\scripts\sample.ps1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs the Sample.ps1 script as a background job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -name WinRm -scriptblock {get-process winrm} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command runs a background job that gets the WinRM process on the local computer. The command uses the ScriptBlock parameter to specify the command that runs in the background job. It uses the Name parameter to specify a friendly name for the new job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> start-job -name GetMappingFiles -initializationScript {import-module MapFunctions} -scriptblock {Get-Map -name * | set-content D:\Maps.tif} -runAs32 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command starts a job that collects a large amount of data and saves it in a .tif file. The command uses the InitializationScript parameter to run a script block that imports a required module. It also uses the RunAs32 parameter to run the job in a 32-bit process even if the computer has a 64-bit operating system.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113405</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_Details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Receive-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Wait-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Stop-Job </command:name> <maml:description> <maml:para>Stops a Windows PowerShell background job.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Stop</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Stop-Job cmdlet stops Windows PowerShell background jobs that are in progress. You can use this cmdlet to stop all jobs or stop selected jobs based on their name, ID, instance ID, or state, or by passing a job object to Stop-Job. You can use Stop-Job to stop jobs that were started by using Start-Job or the AsJob parameter of Invoke-Command. When you stop a background job, Windows PowerShell completes all tasks that are pending in that job queue and then ends the job. No new tasks are added to the queue after this command is submitted. This cmdlet does not delete background jobs. To delete a job, use Remove-Job. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Stop-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Stops only jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the jobs to be stopped. Enter a variable that contains the jobs or a command that gets the jobs. You can also use a pipeline operator to submit jobs to the Stop-Job cmdlet. By default, Stop-Job deletes all jobs that were started in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Stops only the jobs with the specified friendly names. Enter the job names in a comma-separated list or use wildcard characters (*) to enter a job name pattern. By default, Stop-Job stops all jobs created in the current session. Because the friendly name is not guaranteed to be unique, use the WhatIf and Confirm parameters when stopping jobs by name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Stops jobs with the specified IDs. The default is all jobs in the current session. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-Job</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Stops only jobs within the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >NotStarted</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Running</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Completed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Failed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Stopped</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Blocked</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Stops jobs with the specified IDs. The default is all jobs in the current session. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Stops only jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Specifies the jobs to be stopped. Enter a variable that contains the jobs or a command that gets the jobs. You can also use a pipeline operator to submit jobs to the Stop-Job cmdlet. By default, Stop-Job deletes all jobs that were started in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> <dev:type> <maml:name>Job[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Stops only the jobs with the specified friendly names. Enter the job names in a comma-separated list or use wildcard characters (*) to enter a job name pattern. By default, Stop-Job stops all jobs created in the current session. Because the friendly name is not guaranteed to be unique, use the WhatIf and Confirm parameters when stopping jobs by name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Returns an object representing the new background job. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Stops only jobs within the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobState</command:parameterValue> <dev:type> <maml:name>JobState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.RemotingJob</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a job object to Stop-Job. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or System.Management.Automation.RemotingJob</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> When you use the PassThru parameter, Stop-Job returns a job object. Otherwise, this cmdlet does not generate any output. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession -computername Server01 -credential domain01\admin02 C:\PS> $j = invoke-command -session $s -scriptblock {start-job -scriptblock {get-eventlog system}} C:\PS> invoke-command -session $s -scriptblock {param($j) stop-job -job $j} -ArgumentList $j </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Stop-Job cmdlet to stop a job that is running on a remote computer. Because the job was started by using Invoke-Command to run a Start-Job command remotely, the job object is stored on the remote computer, and you must use another Invoke-Command command to run a Stop-Job command remotely. For more information about remote background jobs, see about_Remote_Jobs. The first command creates a Windows PowerShell session (PSSession) on the Server01 computer and saves the session object in the $s variable. The command uses the credentials of a domain administrator. The second command uses the Invoke-Command cmdlet to run a Start-Job command in the session. The command in the job gets all of the events in the System event log. The resulting job object is stored in the $j variable. The third command stops the job. It uses the Invoke-Command cmdlet to run a Stop-Job command in the PSSession on Server01. Because the job objects are stored in $j, which is a variable on the local computer, the command uses the "param" keyword to declare the local variables in the command, and it uses the ArgumentList parameter to supply values for the variables. When the command completes, the job is stopped and the PSSession in $s is available for use.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> stop-job -state failed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command stops all jobs with a State value of "Failed".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> stop-job -name job1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command stops the Job1 background job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> stop-job -id 1, 3, 4 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command stops three jobs. It identifies them by their IDs.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job | stop-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command stops all the background jobs in the current session.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> stop-job -state blocked </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command stops all the jobs with a job status of "Blocked".</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job | format-table ID, Name, Command, @{Label="State";Expression={$_.jobstateinfo.state}}, I nstanceID -auto Id Name Command State InstanceId -- ---- ------- ----- ---------- 1 Job1 start-service schedule Running 05abb67a-2932-4bd5-b331-c0254b8d9146 3 Job3 start-service schedule Running c03cbd45-19f3-4558-ba94-ebe41b68ad03 5 Job5 get-service s* Blocked e3bbfed1-9c53-401a-a2c3-a8db34336adf C:\PS> stop-job -instanceid e3bbfed1-9c53-401a-a2c3-a8db34336adf </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands show how to stop a job based on its instance ID. The first command uses a Get-Job command to get the jobs in the current session. The command uses a pipeline operator (|) to send the jobs to a Format-Table command, which displays a table of the specified properties of each job. The table includes the Instance ID of each job. It uses a calculated property to display the job state. The second command uses a Stop-Job command with the InstanceID parameter to stop a selected job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $j = invoke-command -computername Server01 -scriptblock {get-eventlog system} -asjob C:\PS> $j | stop-job -passthru Id Name State HasMoreData Location Command -- ---- ---- ----------- -------- ------- 5 Job5 Stopped True judithh-tablet get-eventlog system </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Stop-Job cmdlet to stop a job that is running on a remote computer. Because the job was started by using the AsJob parameter of Invoke-Command, the job object is located on the local computer, even though the job runs on the remote computer. As such, you can use a local Stop-Job command to stop the job. The first command uses the Invoke-Command cmdlet to start a background job on the Server01 computer. The command uses the AsJob parameter to run the remote command as a background job. This command returns a job object, which is the same job object that Start-Job returns. The command saves the job object in the $j variable. The second command uses a pipeline operator to send the job in the $j variable to Stop-Job. The command uses the PassThru parameter to direct Stop-Job to return a job object. The job object display confirms that the State of the job is "Stopped". For more information about remote background jobs, see about_Remote_Jobs. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113413</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_Details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Receive-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Wait-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Test-ModuleManifest </command:name> <maml:description> <maml:para>Verifies that a module manifest file accurately describes the contents of a module.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Test</command:verb> <command:noun>ModuleManifest</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Test-ModuleManifest cmdlet verifies that the files that are listed in the module manifest (.psd1) file actually exist in the specified paths. This cmdlet is designed to help module authors test their manifest files. Module users can also use this cmdlet in scripts and commands to detect errors before running scripts that depend on the module. The Test-ModuleManifest cmdlet returns an object that represents the module (the same type of object that Get-Module returns). If any files are not in the locations specified in the manifest, the cmdlet also generates an error for each missing file.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Test-ModuleManifest</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the module manifest file. Enter a path (optional) and the name of the module manifest file with the .psd1 file name extension. The default location is the current directory. This parameter is required. The parameter name ("Path") is optional. You can also pipe a path to Test-ModuleManifest. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the module manifest file. Enter a path (optional) and the name of the module manifest file with the .psd1 file name extension. The default location is the current directory. This parameter is required. The parameter name ("Path") is optional. You can also pipe a path to Test-ModuleManifest. </maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe the path to a module manifest to Test-ModuleManifest. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.PSModuleInfo</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Test-ModuleManifest returns a PSModuleInfo object that represents the module. It returns this object even if the manifest has errors. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> test-ModuleManifest -path $pshome\Modules\TestModule.psd1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command tests the TestModule.psd1 module manifest.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> "$pshome\Modules\TestModule.psd1" | test-modulemanifest Test-ModuleManifest : The specified type data file 'C:\Windows\System32\Wi ndowsPowerShell\v1.0\Modules\TestModule\TestTypes.ps1xml' could not be pro cessed because the file was not found. Please correct the path and try aga in. At line:1 char:34 + "$pshome\Modules\TestModule.psd1" | test-modulemanifest <<<< + CategoryInfo : ResourceUnavailable: (C:\Windows\System32\Win dowsPowerShell\v1.0\Modules\TestModule\TestTypes.ps1xml:String) [Test-Modul eManifest], FileNotFoundException + FullyQualifiedErrorId : Modules_TypeDataFileNotFound,Microsoft. PowerShell.Commands.TestModuleManifestCommandName Name : TestModule Path : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Test Module\TestModule.psd1 Description : Guid : 6f0f1387-cd25-4902-b7b4-22cff6aefa7b Version : 1.0 ModuleBase : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Test Module ModuleType : Manifest PrivateData : AccessMode : ReadWrite ExportedAliases : {} ExportedCmdlets : {} ExportedFunctions : {} ExportedVariables : {} NestedModules : {} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command uses a pipeline operator (|) to send a path string to Test-ModuleManifest. The command output shows that the test failed, because the TestTypes.ps1xml file, which was listed in the manifest, was not found.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> function Bool-ModuleManifest ($path) {$a = dir $path | test-modulemanifest -erroraction SilentlyContinue; $?} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This function is like Test-ModuleManifest, but it returns a Boolean value; it returns "True" if the manifest passed the test and "False" otherwise. The function uses the Get-ChildItem cmdlet (alias = dir) to get the module manifest specified by the $path variable. It uses a pipeline operator (|) to pass the file object to the Test-ModuleManifest cmdlet. The Test-ModuleManifest command uses the ErrorAction common parameter with a value of SilentlyContinue to suppress the display of any errors that the command generates. It also saves the PSModuleInfo object that Test-ModuleManifest returns in the $a variable, so the object is not displayed. Then, in a separate command (the semi-colon [;] is the command separator), it displays the value of the $? automatic variable, which returns "True" if the previous command generated no error and "False" otherwise. You can use this function in conditional statements, such as those that might precede an Import-Module command or a command that uses the module.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=141557</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Import-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Module</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Export-ModuleMember</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-ModuleManifest</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Modules</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Unregister-PSSessionConfiguration </command:name> <maml:description> <maml:para>Deletes registered session configurations from the computer.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Unregister</command:verb> <command:noun>PSSessionConfiguration</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Unregister-PSSessionConfiguration cmdlet deletes registered session configurations from the computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users. If you accidentally delete the default Microsoft.PowerShell or Microsoft.PowerShell32 session configurations, use the Enable-PSRemoting cmdlet to restore them. </maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Unregister-PSSessionConfiguration</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to delete. Enter one or more configuration names. Wildcards are permitted. This parameter is required. You can also pipe a session configuration object to Unregister-PSSessionConfiguration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter an Unregister-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the change effective. Until the WinRM service is restarted, users can still use the unregistered session configuration, even though Get-PSSessionConfiguration does not find it. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Force</maml:name> <maml:description> <maml:para>Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the names of session configurations to delete. Enter one or more configuration names. Wildcards are permitted. This parameter is required. You can also pipe a session configuration object to Unregister-PSSessionConfiguration.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">string</command:parameterValue> <dev:type> <maml:name>string</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter an Unregister-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the change effective. Until the WinRM service is restarted, users can still use the unregistered session configuration, even though Get-PSSessionConfiguration does not find it. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Describes what would happen if you executed the command without actually executing the command.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue /> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name> Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a session configuration object from Get-PSSessionConfiguration to Unregister-PSSessionConfiguration. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> This cmdlet does not return any objects. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option. </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> unregister-pssessionconfiguration -name MaintenanceShell </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command deletes the MaintenanceShell session configuration from the computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> unregister-pssessionconfiguration -maintenanceShell -force </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command deletes the MaintenanceShell session configuration from the computer. The command uses the Force parameter to suppress all user messages and to restart the WinRM service without prompting.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> unregister-pssessionconfiguration -name * C:\PS> get-pssessionconfiguration -name * | unregister-pssessionconfiguration </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>These commands delete all of the session configurations on the computer. The commands have the same effect and can be used interchangeably.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> unregister-pssessionconfiguration -name maintenanceShell -noServiceRestart C:\PS> get-pssessionconfiguration -name maintenanceShell Get-PSSessionConfiguration -name maintenanceShell : No Session Configuration matches criteria "maintenanceShell". + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException C:\PS> new-pssession -configurationName MaintenanceShell Id Name ComputerName State Configuration Availability -- ---- ------------ ----- ------------- ------------ 1 Session1 localhost Opened MaintenanceShell Available C:\PS> restart-service winrm C:\PS> new-pssession -configurationName MaintenanceShell [localhost] Connecting to remote server failed with the following error message : The WS-Management service cannot process the request. The resource URI (http://schemas.microsoft.com/powershell/MaintenanceShell) was not found in the WS-Management catalog. The catalog contains the metadata that describes resour ces, or logical endpoints. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionOpenFailed </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows the effect of using the NoServiceRestart parameter of Unregister-PSSessionConfiguration. This parameter is designed to prevent a service restart, which would disrupt any sessions on the computer. The first command uses the Unregister-PSSessionConfiguration cmdlet to deletes the MaintenanceShell session configuration. However, because the command uses the NoServiceRestart parameter, the WinRM service is not restarted and the change is not yet completely effective. The second command uses the Get-PSSessionConfiguration cmdlet to get the MaintenanceShell session. Because the session has been removed from the WS-Management resource table, Get-PSSession cannot return it. The third command uses the New-PSSession cmdlet to create a session on the local computer that uses the MaintenanceShell configuration. The command succeeds. The fourth command uses the Restart-Service cmdlet to restart the WinRM service. The fifth command again uses the New-PSSession cmdlet to create a session that uses the MaintenanceShell configuration. This time, the session fails because the MaintenanceShell configuration has been deleted.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=144308</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Session_Configurations</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Register-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-PSSessionConfiguration</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>WS-Management Provider</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Wait-Job </command:name> <maml:description> <maml:para>Suppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are complete.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Wait</command:verb> <command:noun>Job</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Wait-Job cmdlet waits for Windows PowerShell background jobs to complete before it displays the command prompt. You can wait until any background job is complete, or until all background jobs are complete, and you can set a maximum wait time for the job. You can use Wait-Job to get background jobs that were started by using Start-Job or the AsJob parameter of Invoke-Command. When the commands in the job are complete, Wait-Job displays the command prompt and returns a job object so that you can pipe it to another command.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Wait-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Waits for jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Wait-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Waits for the specified jobs. Enter a variable that contains the job objects or a command that gets the job objects. You can also use a pipeline operator to send job objects to the Wait-Job cmdlet. By default, Wait-Job waits for all jobs created in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Wait-Job</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Waits for jobs with the specified friendly name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Wait-Job</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Waits for jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Wait-Job</maml:name> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Waits for jobs in the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" variableLength="false" >NotStarted</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Running</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Completed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Failed</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Stopped</command:parameterValue> <command:parameterValue required="false" variableLength="false" >Blocked</command:parameterValue> </command:parameterValueGroup> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Any</maml:name> <maml:description> <maml:para>Displays the command prompt (and returns the job object) when any job completes. By default, Wait-Job waits until all of the specified jobs are complete before displaying the prompt.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Id</maml:name> <maml:description> <maml:para>Waits for jobs with the specified IDs. The ID is an integer that uniquely identifies the job within the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. You can type one or more IDs (separated by commas). To find the ID of a job, type "Get-Job" without parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Int32[]</command:parameterValue> <dev:type> <maml:name>Int32[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>InstanceId</maml:name> <maml:description> <maml:para>Waits for jobs with the specified instance IDs. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Guid[]</command:parameterValue> <dev:type> <maml:name>Guid[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="1"> <maml:name>Job</maml:name> <maml:description> <maml:para>Waits for the specified jobs. Enter a variable that contains the job objects or a command that gets the job objects. You can also use a pipeline operator to send job objects to the Wait-Job cmdlet. By default, Wait-Job waits for all jobs created in the current session.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">Job[]</command:parameterValue> <dev:type> <maml:name>Job[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="1"> <maml:name>Name</maml:name> <maml:description> <maml:para>Waits for jobs with the specified friendly name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="true">string[]</command:parameterValue> <dev:type> <maml:name>string[]</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named"> <maml:name>State</maml:name> <maml:description> <maml:para>Waits for jobs in the specified state. Valid values are NotStarted, Running, Completed, Stopped, Failed, and Blocked.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobState</command:parameterValue> <dev:type> <maml:name>JobState</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Determines the maximum wait time for each background job, in seconds. The default, -1, waits until the job completes, no matter how long it runs. The timing starts when you submit the Wait-Job command, not the Start-Job command. If this time is exceeded, the wait ends and the command prompt returns, even if the job is still running. No error message is displayed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">int</command:parameterValue> <dev:type> <maml:name>int</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.RemotingJob</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe a job object to Wait-Job. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Management.Automation.RemotingJob</maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> Wait-Job returns job objects that represent the completed jobs. If the wait ends because the value of the Timeout parameter is exceeded, Wait-Job does not return any objects. </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job | wait-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command waits for all of the background jobs running in the session to complete.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession server01, server02, server03 C:\PS> invoke-command -session $s -scriptblock {start-job -name Date1 -scriptblock {get-date}} C:\PS> $done = invoke-command -session $s -command {wait-job -name Date1} C:\PS> $done.count 3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Wait-Job cmdlet with jobs started on remote computers by using the Start-Job cmdlet. Both the Start-Job and Wait-Job commands are submitted to the remote computer by using the Invoke-Command cmdlet. This example uses Wait-Job to determine whether a Get-Date command running as a background job on three different computers is complete. The first command creates a Windows PowerShell session (PSSession) on each of the three remote computers and stores them in the $s variable. The second command uses the Invoke-Command cmdlet to run a Start-Job command in each of the three sessions in $s. All of the jobs are named Date1. The third command uses the Invoke-Command cmdlet to run a Wait-Job command. This command waits for the Date1 jobs on each computer to complete. It stores the resulting collection (array) of job objects in the $done variable. The fourth command uses the Count property of the array of job objects in the $done variable to determine how many of the jobs are complete.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession (get-content machines.txt) C:\PS> $c = 'get-eventlog -log system | where {$_.EntryType -eq "error" -and $_.Source -eq "LSASRV"} | out-file errors.txt' C:\PS> invoke-command -session $s -scriptblock {param($c)start-job -scriptblock {$c}} -ArgumentList $c C:\PS> invoke-command -session $s -scriptblock {wait-job -any} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example uses the Any parameter of Wait-Job to determine when the first of many background jobs running in the current session are complete. It also shows how to use the Wait-Job cmdlet to wait for remote jobs to complete. The first command creates a PSSession on each of the computers listed in the Machines.txt file and stores the PSSessions in the $s variable. The command uses the Get-Content cmdlet to get the contents of the file. The Get-Content command is enclosed in parentheses to ensure that it runs before the New-PSSession command. The second command stores a Get-EventLog command string (in quotation marks) in the $c variable. The third command uses the Invoke-Command cmdlet to run a Start-Job command in each of the sessions in $s. The Start-Job command starts a background job that runs the command in $c. Because the $c variable is on the local computer, the command uses the "param" keyword to declare the local variables in the command and the ArgumentList parameter to supply the values for those variables. The fourth command uses the Invoke-Command cmdlet to run a Wait-Job command in the sessions. It uses the Wait-Job cmdlet to wait until the first job on the remote computers is complete.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession Server01, Server02, Server03 C:\PS> $jobs = invoke-command -session $s -scriptblock {start-job -script {get-date}} C:\PS> $done = invoke-command -session $s -scriptblock {wait-job -timeout 30} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Timeout parameter of Wait-Job to set a maximum wait time for the jobs running on remote computers. The first command creates a PSSession on each of three remote computers (Server01, Server02, and Server03), and it saves the PSSessions in the $s variable. The second command uses the Invoke-Command cmdlet to run a Start-Job command in each of the PSSessions in $s. It saves the resulting job objects in the $jobs variable. The third command uses the Invoke-Command cmdlet to run a Wait-Job command in each of the PSSessions in $s. The Wait-Job command determines whether all of the commands have completed within 30 seconds. It uses the Timeout parameter with a value of 30 (seconds) to establish the maximum wait time and saves the results of the command in the $done variable. In this case, after 30 seconds, only the command on the Server02 computer has completed. Wait-Job ends the wait, displays the command prompt, and returns the object that represents the job that was completed. The $done variable contains a job object that represents the job that ran on Server02.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 5 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> wait-job -id 1,2,5 -any </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command identifies three jobs by their IDs and waits until any of them are complete. The command prompt returns when the first job completes.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 6 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> wait-job -name DailyLog -timeout 120 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command waits 120 seconds (two minutes) for the DailyLog job to complete. If the job does not complete in the next two minutes, the command prompt returns anyway, and the job continues to run in the background.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 7 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> wait-job -name Job3 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This Wait-Job command uses the job name to identify the job to wait for.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 8 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> C:\PS> $j = start-job -script {get-childitem *.ps1| where {$_lastwritetime -gt ((get-date) - (new-timespan -days 7))}} C:\PS> $j | wait-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Wait-Job cmdlet with jobs started on the local computer by using the Start-Job cmdlet. These commands start a job that gets the Windows PowerShell script files that were added or updated in the last week. The first command uses the Start-Job cmdlet to start a background job on the local computer. The job runs a Get-ChildItem command that gets all of the files with a ".ps1" file name extension that were added or updated in the last week. The third command uses the Wait-Job cmdlet to wait until the job is complete. When the job completes, the command displays the job object, which contains information about the job.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 9 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> $s = new-pssession Server01, Server02, Server03 C:\PS> $j = invoke-command -session $s -scriptblock {get-process} -asjob C:\PS> $j | wait-job </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This example shows how to use the Wait-Job cmdlet with jobs started on remote computers by using the AsJob parameter of the Invoke-Command cmdlet. When using AsJob, the job is created on the local computer and the results are automatically returned to the local computer, even though the job runs on the remote computers. This example uses Wait-Job to determine whether a Get-Process command running in the sessions on three remote computers is complete. The first command creates PSSessions on three computers and stores them in the $s variable. The second command uses the Invoke-Command cmdlet to run a Get-Process command in each of the three PSSessions in $s. The command uses the AsJob parameter to run the command asynchronously as a background job. The command returns a job object, just like the jobs started by using Start-Job, and the job object is stored in the $j variable. The third command uses a pipeline operator (|) to send the job object in $j to the Wait-Job cmdlet. Notice that an Invoke-Command command is not required in this case, because the job resides on the local computer.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 10 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-job Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Completed True localhost,server01.. get-service 4 Job4 Completed True localhost dir | where C:\PS> wait-job -id 1 </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command waits for the job with an ID value of 1. </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113422</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Job_Details</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>about_Remote_Jobs</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Receive-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-Job</maml:linkText> <maml:uri/> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-Command</maml:linkText> <maml:uri/> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name> Where-Object </command:name> <maml:description> <maml:para>Creates a filter that controls which objects will be passed along a command pipeline.</maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Where</command:verb> <command:noun>Object</command:noun> <dev:version></dev:version> </command:details> <maml:description> <maml:para>The Where-Object cmdlet selects objects from the set of objects that are passed to it. It uses a script block as a filter and evaluates the script block for each object. If the result of the evaluation is True, the object is returned. If the result of the evaluation is not True, the object is ignored.</maml:para> </maml:description> <!-- Cmdlet syntax section--> <command:syntax> <command:syntaxItem> <maml:name>Where-Object</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>FilterScript</maml:name> <maml:description> <maml:para>Specifies the script block that is used to filter the objects. Enclose the script block in braces ( {} ).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the objects to be filtered. You can also pipe the objects to Where-Object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <!-- Cmdlet parameter section --> <command:parameters> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1"> <maml:name>FilterScript</maml:name> <maml:description> <maml:para>Specifies the script block that is used to filter the objects. Enclose the script block in braces ( {} ).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">scriptblock</command:parameterValue> <dev:type> <maml:name>scriptblock</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the objects to be filtered. You can also pipe the objects to Where-Object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">psobject</command:parameterValue> <dev:type> <maml:name>psobject</maml:name> <maml:uri/> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <!-- Input - Output section--> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> <maml:uri/> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> You can pipe the objects to be filtered to Where-Object. </maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name></maml:name> <maml:uri /> <maml:description /> </dev:type> <maml:description> <maml:para> <!-- description --> </maml:para> </maml:description> </command:returnValue> </command:returnValues> <!-- Error section--> <command:terminatingErrors /> <command:nonTerminatingErrors /> <!-- Notes section --> <maml:alertSet> <maml:title></maml:title> <maml:alert> <maml:para> </maml:para> </maml:alert> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <!-- Example section --> <command:examples> <command:example> <maml:title> -------------------------- EXAMPLE 1 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-service | where-object {$_.Status -eq "Stopped"} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets a list of all services that are currently stopped. The "$" symbol represents each object that is passed to the Where-Object cmdlet.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 2 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-process | where-object {$_.workingset -gt 25000*1024} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command lists processes that have a working set greater than 25,000 kilobytes (KB). Because the value of the WorkingSet property is stored in bytes, the value of 25,000 is multiplied by 1,024.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 3 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-process | where-object { $_.ProcessName -match "^p.*" } </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command gets the processes with a ProcessName property that begins with the letter "p". The match operator enables you to use regular expressions within a Where clause.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> <command:example> <maml:title> -------------------------- EXAMPLE 4 -------------------------- </maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code> get-process -name svchost | where-object {$True} </dev:code> <dev:remarks> <maml:para>Description</maml:para> <maml:para>-----------</maml:para> <maml:para>This command lists all of the processes named "svchost". The Where-Object cmdlet evaluates the script block, which typically includes a reference to the object currently in the pipeline ($_), and casts the results to a Boolean type: True or False. If the result is True, the object is returned. Otherwise, it is discarded. In this case, the script block just returns True, so all the objects are returned.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para></maml:para> </dev:remarks> <command:commandLines> <command:commandLine> <command:commandText></command:commandText> </command:commandLine> </command:commandLines> </command:example> </command:examples> <!-- Link section --> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Online version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113423</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <!-- v 1.1.0.9 --> <providerHelp> <Name> Alias </Name> <Drives> <Para>Alias:</Para> </Drives> <Synopsis> Provides access to the Windows PowerShell aliases and the values that they represent. </Synopsis> <DetailedDescription> <para>The Windows PowerShell Alias provider lets you get, add, change, clear, and delete aliases in Windows PowerShell. An alias is an alternate name for a cmdlet, function, or executable file. Windows PowerShell includes a set of built-in aliases. And, you can add your own aliases to the current session and to your Windows PowerShell profile. The Alias provider is a flat namespace that contains only the alias objects. The aliases have no child items. Each alias is an instance of the System.Management.Automation.AliasInfo class. The Alias provider exposes its data store in the Alias: drive. To work with aliases, you can change your location to the Alias: drive by using the following command: set-location alias: Or, you can work from any other Windows PowerShell drive. To reference an alias from another location, use the Alias: drive name in the path. Windows PowerShell includes a set of cmdlets that are designed to view and to change aliases: Export-Alias Get-Alias Import-Alias New-Alias Set-Alias When you use these cmdlets, you do not need to specify the Alias: drive in the name. The Alias provider supports all the cmdlets that have the Item noun except for the Invoke-Item cmdlet. And, it supports the Get-Content and Set-Content cmdlets. The Alias provider does not support the cmdlets that have the ItemProperty noun. And, the Alias provider does not support the Filter parameter in any cmdlet. All changes to the aliases affect the current session only. To save the changes, add the changes to the Windows PowerShell profile. Or, use the Export-Alias and Import-Alias cmdlets.</para> </DetailedDescription> <Capabilities> <para></para> </Capabilities> <Filters> <para></para> </Filters> <Notes> </Notes> <Tasks> <Task> <Title> Getting to the Alias: Drive </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command changes the current location to the Alias: drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type "set-location c:".</para> </Introduction> <Code> set-location alias: </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Getting Aliases </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command gets a list of all the aliases in the current session. You can use this command in any Windows PowerShell drive.</para> </Introduction> <Code> get-item -path alias: </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets the "ls" alias. Because it includes the path, you can use it in any Windows PowerShell drive.</para> </Introduction> <Code> get-item -path alias:ls </Code> <Remarks> <para>If you are in the Alias: drive, you can omit the drive name from the path. </para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command gets a list of the aliases that are associated with the Get-ChildItem cmdlet. It uses the Definition property, which stores the cmdlet name.</para> </Introduction> <Code> get-item -path alias:* | where-object {$_.Definition -eq "Get-Childitem"} </Code> <Remarks> <para>When the aliased item is an executable file, the Definition contains the fully qualified path of the file.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 4 -------------------------- </Title> <Introduction> <para>This command gets the list of all the aliases when the current location is the Alias: drive. It uses a wildcard character (*) to indicate all the contents of the current location.</para> </Introduction> <Code> get-item -path * </Code> <Remarks> <para>In the Alias: drive, a dot (.), which represents the current location, and a wildcard character (*), which represents all items in the current location, have the same effect. For example, "get-item -path ." or "get-item *" produce the same result.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Creating a New Alias </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command creates the "serv" alias for the Get-Service cmdlet. Because the current location is in the Alias: drive, the value of the Path parameter is a dot (.). The dot represents the current location. This command also uses the Options dynamic parameter to set the AllScope and Constant options on the alias. The Options parameter is available in the New-Item cmdlet only when you are in the Alias: drive.</para> </Introduction> <Code> new-item -path . -name serv -value Get-Service -Options "AllScope,Constant" </Code> <Remarks> <para>If you are in the Alias: drive, you can omit the drive name from the path. </para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>You can create an alias for any item that invokes a command. This command creates the "np" alias for Notepad.exe. </para> </Introduction> <Code> new-item -path alias:np -value c:\windows\notepad.exe </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>You can create an alias for any function. You can use this feature to create an alias that includes both a cmdlet and its parameters. The first command creates the CD32 function, which changes the current directory to the System32 directory. The second command creates the "go" alias for the CD32 function. The semi-colon (;) is the command separator. When the command is complete, you can use either "CD32" or "go" to invoke the function.</para> </Introduction> <Code> function CD32 {set-location -path c:\windows\system32} set-item -path alias:go -value CD32 </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Displaying the Properties and Methods of Aliases </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Get-Item cmdlet to get all aliases. The pipeline operator (|) sends the results to the Get-Member cmdlet, which displays the methods and properties of the object.</para> </Introduction> <Code> get-item -path alias:* | get-member </Code> <Remarks> <para>When you pipe a collection of objects to Get-Member, such as the collection of aliases in the Alias: drive, Get-Member evaluates each object in the collection separately. Then, Get-Member returns information about each object type that it finds. If all the objects are of the same type, it returns information about the single object type. In this case, all the aliases are AliasInfo objects. To get information about the collection of AliasInfo objects, use the InputObject parameter of Get-Member. For example, use the following command: Get-Member -InputObject (Get-Item alias:*) When you use InputObject, Get-Member evaluates the collection, not the objects in the collection.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command lists the values of the properties of the "dir" alias. It uses the Get-Item cmdlet to get an object that represents the "dir" alias. The pipeline operator (|) sends the results to the Format-List command. The Format-List command uses the Property parameter with a wildcard character (*) to format and display the values of all the "dir" alias properties.</para> </Introduction> <Code> get-item alias:dir | format-list -property * </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Changing the Properties of an Alias </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>You can use the Set-Item cmdlet with the Options dynamic parameter to change the value of the Options property of an alias. This command sets the AllScope and ReadOnly options for the "dir" alias. The command uses the Options dynamic parameter of the Set-Item cmdlet. The Options parameter is available in Set-Item only when you use it with the Alias or Function provider.</para> </Introduction> <Code> set-item -path alias:dir -options "AllScope,ReadOnly" </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command uses the Set-Item cmdlet to change the "gp" alias so that it represents the Get-Process cmdlet instead of the Get-ItemProperty cmdlet. The Force parameter is required because the value of the Options property of the "gp" alias is set to ReadOnly. Because the command is submitted from within the Alias: drive, the drive is not specified in the path.</para> </Introduction> <Code> set-item -path gp -value get-process -force </Code> <Remarks> <para>The change affects the four properties that define the association between the alias and the command. To view the effect of the change, type the following command: get-item -path gp | format-list -property *</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command uses the Rename-Item cmdlet to change the "popd" alias to "pop". </para> </Introduction> <Code> rename-item -path alias:popd -newname pop </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Copying an Alias </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command copies the pushd alias so that a new push alias is created for the Push-Location cmdlet.</para> </Introduction> <Code> copy-item -path alias:pushd -destination alias:push </Code> <Remarks> <para>When the new alias is created, its Description property has a null value. And, its Option property has a value of None. If the command is issued from within the Alias: drive, you can omit the drive name from the value of the Path parameter.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Deleting an Alias </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command deletes the serv alias from the current session. You can use this command in any Windows PowerShell drive.</para> </Introduction> <Code> remove-item -path alias:serv </Code> <Remarks> <para>If you are in the Alias: drive, you can omit the drive name from the path.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command deletes aliases that begin with "s". It does not delete read-only aliases.</para> </Introduction> <Code> clear-item -path alias:s* </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command deletes all aliases from the current session, except those with a value of Constant for their Options property. Without the Force parameter, the command does not delete aliases whose Options property has a value of ReadOnly.</para> </Introduction> <Code> remove-item alias:* -force </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> <DynamicParameter> <Name>Options</Name> <CmdletSupported>New-Item, Set-Item</CmdletSupported> <Type> <Name>System.Management.Automation.ScopedItemOptions</Name> </Type> <Description>Determines the value of the Options property of an alias.</Description> <PossibleValues> <PossibleValue> <Value>None</Value> <Description> <para>No options. This value is the default.</para> </Description> </PossibleValue> <PossibleValue> <Value>Constant</Value> <Description> <para>The alias cannot be deleted and its properties cannot be changed. Constant is available only when you create an alias. You cannot change the option of an existing alias to Constant.</para> </Description> </PossibleValue> <PossibleValue> <Value>Private</Value> <Description> <para>The alias is visible only in the current scope, not in the child scopes.</para> </Description> </PossibleValue> <PossibleValue> <Value>ReadOnly</Value> <Description> <para>The properties of the alias cannot be changed except by using the Force parameter. You can use Remove-Item to delete the alias.</para> </Description> </PossibleValue> <PossibleValue> <Value>AllScope</Value> <Description> <para>The alias is copied to any new scopes that are created.</para> </Description> </PossibleValue> </PossibleValues> </DynamicParameter> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Aliases</linkText> <uri/> </navigationLink> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> <!-- v 1.1.0.9 --> <providerHelp> <Name> Environment </Name> <Drives> <Para>Env:</Para> </Drives> <Synopsis> Provides access to the Windows environment variables. </Synopsis> <DetailedDescription> <para>The Windows PowerShell Environment provider lets you get, add, change, clear, and delete Windows environment variables in Windows PowerShell. The Environment provider is a flat namespace that contains only objects that represent the environment variables. The variables have no child items. Each environment variable is an instance of the System.Collections.DictionaryEntry class. The name of the variable is the dictionary key. The value of the environment variable is the dictionary value. The Environment provider exposes its data store in the Env: drive. To work with environment variables, change your location to the Env: drive ("set-location env:"), or work from another Windows PowerShell drive. To reference an environment variable from another location, use the Env: drive name in the path. The environment variable provider supports all the cmdlets that contain the Item noun except for Invoke-Item. And, it supports the Get-Content and Set-Content cmdlets. However, it does not support the cmdlets that contain the ItemProperty noun, and it does not support the Filter parameter in any cmdlet. Environment variables must conform to the usual naming standards. Additionally, the name cannot include the equal sign (=). Changes to the environment variables affect the current session only. To save the changes, add the changes to the Windows PowerShell profile, or use Export-Console to save the current session.</para> </DetailedDescription> <Capabilities> <para></para> </Capabilities> <Filters> <para></para> </Filters> <Notes> The Environment provider does not support any dynamic parameters. </Notes> <Tasks> <Task> <Title> Getting to the Env: Drive </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command changes the current location to the Env: drive: </para> </Introduction> <Code> set-location env: </Code> <Remarks> <para>You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type: set-location c:</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Getting Environment Variables </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command lists all the environment variables in the current session: </para> </Introduction> <Code> get-childitem -path env: </Code> <Remarks> <para>You can use this command from any Windows PowerShell drive.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets the WINDIR environment variable:</para> </Introduction> <Code> get-childitem -path env:windir </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command gets a list of all the environment variables in the current session and then sorts them by name: </para> </Introduction> <Code> get-childitem | sort-object -property name </Code> <Remarks> <para>By default, the environment variables appear in the order that Windows PowerShell discovers them. This command is submitted in the Env: drive. When you run this command from another drive, add the Path parameter with a value of Env:.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Creating a New Environment Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command creates the USERMODE environment variable with a value of Non-Admin: </para> </Introduction> <Code> new-item -path . -name USERMODE -value Non-Admin </Code> <Remarks> <para>Because the current location is in the Env: drive, the value of the Path parameter is a dot (.). The dot represents the current location. If you are not in the Env: drive, the value of the Path parameter would be Env:.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Displaying the Properties and Methods of Environment Variables </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Get-ChildItem cmdlet to get all the environment variables:</para> </Introduction> <Code> get-childitem -path env: | get-member </Code> <Remarks> <para>The pipeline operator (|) sends the results to Get-Member, which displays the methods and properties of the object. When you pipe a collection of objects to Get-Member, such as the collection of environment variables in the Env: drive, Get-Member evaluates each object in the collection separately. Get-Member then returns information about each object type that it finds. If all the objects are of the same type, it returns information about the single object type. In this case, all the environment variables are DictionaryEntry objects. To get information about the collection of DictionaryEntry objects, use the InputObject parameter of Get-Member. For example, type: get-member -inputobject (get-childitem env:) When you use the InputObject parameter, Get-Member evaluates the collection, not the objects in the collection.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command lists the values of the properties of the WINDIR environment variable: </para> </Introduction> <Code> get-item env:windir | format-list -property * </Code> <Remarks> <para>It uses the Get-Item cmdlet to get an object that represents the WINDIR environment variable. The pipeline operator (|) sends the results to the Format-List command. It uses the Property parameter with a wildcard character (*) to format and display the values of all the properties of the WINDIR environment variable.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Changing the Properties of an Environment Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Rename-Item cmdlet to change the name of the USERMODE environment variable that you created to USERROLE:</para> </Introduction> <Code> rename-item -path env:USERMODE -newname USERROLE </Code> <Remarks> <para>This change affects the Name, Key, and PSPath properties of the DictionaryEntry object. Do not change the name of an environment variable that the system uses. Although these changes affect only the current session, they might cause the system or a program to operate incorrectly.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command uses the Set-Item cmdlet to change the value of the USERROLE environment variable to Administrator:</para> </Introduction> <Code> set-item -path env:USERROLE -value Administrator </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Copying an Environment Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command copies the value of the USERROLE environment variable to the USERROLE2 environment variable:</para> </Introduction> <Code> copy-item -path env:USERROLE -destination env:USERROLE2 </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Deleting an environment variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command deletes the USERROLE2 environment variable from the current session: </para> </Introduction> <Code> remove-item -path env:USERROLE2 </Code> <Remarks> <para>You can use this command in any Windows PowerShell drive. If you are in the Env: drive, you can omit the drive name from the path.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command deletes the USERROLE environment variable.</para> </Introduction> <Code> clear-item -path env:USERROLE </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> <!-- v 1.1.0.9 --> <providerHelp> <Name> FileSystem </Name> <Drives> <Para>C, D</Para> </Drives> <Synopsis> Provides access to files and directories. </Synopsis> <DetailedDescription> <para>The Windows PowerShell FileSystem provider lets you get, add, change, clear, and delete files and directories in Windows PowerShell. The FileSystem provider exposes Windows PowerShell drives that correspond to the logical drives configured on your computer, including drives mapped to network shares. For example, a computer with one floppy disk drive, one hard disk drive, and one mapped network shared directory might have drives named A, C, and Z. The FileSystem provider exposes Windows PowerShell drives that correspond directly to A, C, and Z, allowing you to reference these drives from within Windows PowerShell. For example, to reference drive C, you use C:, as shown in the following example: get-childitem c: The command returns all the contents on the C drive, including files and directories. When you reference a specific directory or file through the FileSystem provider, you must provide the information necessary to identify that directory or file. This means that, in some cases, you must provide a fully qualified name. A fully qualified name includes the drive name (along with a colon), any directory and subdirectory names, and the file name (when applicable). For instance, the following example shows the fully qualified name for the Shell.dll file, which is located in the System32 subdirectory of the Windows directory on the C drive: c:\windows\system32\shell.dll As you can see, each element of the fully qualified name is separated by a backslash (\). Windows PowerShell also allows you to use a forward slash (/) to be consistent with a variety of other shells. In some cases, you do not need to supply a fully-qualified name when referencing a file or directory. For example, if you want to access a file in your current working location, you need to provide only the file name. If your current working location is c:\windows, you can view a list of all the .dll files in that directory by using the following command: get-childitem *.dll If your working directory is something other than c:\windows, such as c:\program files\Windows PowerShell, your command might need to include the fully qualified name: get-childitem c:\windows\*.dll In some cases, you can use relative references to a location. If your working location is c:\windows, and you want to view a list of .dll files in the c:\windows\system32 directory, you can use the following command: get-childitem .\system32\*.dll The period before \system32 represents the current working location. In some situations, your current working location will be on a drive other than a FileSystem drive. If this is the case, you must always include the name of the target drive in your reference. For example, suppose that your current working location is the env: drive. To view the contents of the C drive, you would use the following command: get-childitem c:</para> </DetailedDescription> <Capabilities> <para></para> </Capabilities> <Filters> <para></para> </Filters> <Notes> </Notes> <Tasks> <Task> <Title> Navigating the File System </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command gets the current location:</para> </Introduction> <Code> get-location </Code> <Remarks> <para>The Get-Location cmdlet includes the functionality of commands like the cd command in the Windows Command Prompt and the pwd command in UNIX. For more information, type: get-help get-location</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command sets the current location:</para> </Introduction> <Code> set-location C: </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Getting File and Directory Information </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command gets all the files and directories in the current directory:</para> </Introduction> <Code> get-childitem </Code> <Remarks> <para>By default, the Get-ChildItem cmdlet does not recurse. If files and folders are present in the current directory when you run this command, a System.IO.FileInfo object and a System.IO.DirectoryInfo object are returned.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets all the files and directories in the current directory by using Get-ChildItem:</para> </Introduction> <Code> get-childitem | where-object {!$_.psiscontainer} </Code> <Remarks> <para>It pipes the results to Where-Object, which examines the PSIsContainer property and lets only the objects that are not (!) containers through the pipeline. </para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command gets all the files and directories in the current directory by using Get-ChildItem. It pipes the results to Where-Object, which examines the PSIsContainer property and lets only the objects that are containers through the pipeline.</para> </Introduction> <Code> get-childitem | where-object {$_.psiscontainer} </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 4 -------------------------- </Title> <Introduction> <para>This command gets all the files and directories in the current directory by using Get-ChildItem:</para> </Introduction> <Code> get-item -path a | format-list * </Code> <Remarks> <para>It pipes the results to the Where-Object cmdlet, which examines the PSIsContainer property and lets only the objects that are containers through the pipeline.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 5 -------------------------- </Title> <Introduction> <para>This command uses the Get-Item cmdlet to get information about the Test.txt file:</para> </Introduction> <Code> get-item -path test.txt | format-list * </Code> <Remarks> <para>The Format-List cmdlet is used to display all the properties of the resulting object.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Copying Files and Directories </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command copies the A.txt file from the C:\A directory to the C:\A\Bb directory:</para> </Introduction> <Code> copy-item -path C:\a\a.txt -destination C:\a\bb\a.txt </Code> <Remarks> <para>It overwrites files in the destination directory without prompting for confirmation.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command copies all the files in the C:\A\Bb directory that have the .txt file name extension to the C:\A\Cc\Ccc\ directory:</para> </Introduction> <Code> copy-item -path C:\a\bb\*.txt -destination C:\a\cc\ccc\ </Code> <Remarks> <para>It uses the original names of the files. The command overwrites the existing files in the destination directory without prompting for confirmation.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>Copies all the directories and files in the C:\a directory to the C:\c directory. If any of the directories to copy already exist in the destination directory, the command will fail unless you specify the Force parameter.</para> </Introduction> <Code> copy-item -path C:\a\* -destination C:\c -recurse </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Moving Files and Directories </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command moves the C.txt file in the C:\A directory to the C:\A\Aa directory: </para> </Introduction> <Code> move-item -path C:\a\c.txt -destination C:\a\aa </Code> <Remarks> <para>The command will not automatically overwrite an existing file that has the same name. To force the cmdlet to overwrite an existing file, specify the Force parameter.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command moves the C:\A directory and all its contents to the C:\B directory: </para> </Introduction> <Code> move-item -path C:\a -destination C:\b </Code> <Remarks> <para>You cannot move a directory when that directory is the current location.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Managing File Content </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command appends the "test content" string to the Test.txt file:</para> </Introduction> <Code> add-content -path test.txt -value "test content" </Code> <Remarks> <para>The existing content in the Test.txt file is not deleted.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets the contents of the Test.txt file and displays them in the console:</para> </Introduction> <Code> get-content -path test.txt </Code> <Remarks> <para>You can pipe the contents of the file to another cmdlet. For example, the following command reads the contents of the Test.txt file and then supplies them as input to the ConvertTo-HTML cmdlet: get-content -path test.txt | convertto-html</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command replaces the contents of the Test.txt file with the "test content" string: </para> </Introduction> <Code> set-content -path test.txt -value "test content" </Code> <Remarks> <para>It overwrites the contents of Test.txt. You can use the Value parameter of the New-Item cmdlet to add content to a file when you create it.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Managing Security Descriptors </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command returns a System.Security.AccessControl.FileSecurity object:</para> </Introduction> <Code> get-acl -path test.txt | format-list -property * </Code> <Remarks> <para>For more information about this object, pipe the command to the Get-Member cmdlet. Or, see "FileSecurity Class" in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=145718.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command returns a System.Security.AccessControl.DirectorySecurity object:</para> </Introduction> <Code> get-acl -path test_directory | format-list -property * </Code> <Remarks> <para>For more information about this object, pipe the command to the Get-Member cmdlet. Or, see "DirectorySecurity Class" in the MSDN library at http://go.microsoft.com/fwlink/?LinkId=145736.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Creating Files and Directories </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command creates the Logfiles directory on the C drive:</para> </Introduction> <Code> new-item -path c:\ -name logfiles -type directory </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command creates the Log2.txt file in the C:\Logfiles directory and then adds the "test log" string to the file:</para> </Introduction> <Code> new-item -path c:\logfiles -name log.txt -type file </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>Creates a file called Log2.txt in the C:\logfiles directory and adds the string "test log" to the file.</para> </Introduction> <Code> new-item -path c:\logfiles -name log2.txt -type file -value "test log" </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Renaming Files and Directories </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command renames the A.txt file in the C:\A directory to B.txt:</para> </Introduction> <Code> rename-item -path c:\a\a.txt -newname b.txt </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command renames the C:\A\Cc directory to C:\A\Dd:</para> </Introduction> <Code> rename-item -path c:\a\cc -newname dd </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Deleting Files and Directories </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command deletes the Test.txt file in the current directory:</para> </Introduction> <Code> remove-item -path test.txt </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command deletes all the files in the current directory that have the .xml file name extension:</para> </Introduction> <Code> remove-item -path *.xml </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Starting a Program by Invoking an Associated File </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>The first command uses the Get-Service cmdlet to get information about local services. It pipes the information to the Export-Csv cmdlet and then stores that information in the Services.csv file. The second command uses Invoke-Item to open the Services.csv file in the program associated with the .csv extension:</para> </Introduction> <Code> get-service | export-csv -path services.csv invoke-item -path services.csv </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> <DynamicParameter> <Name>Encoding </Name> <CmdletSupported>Add-Content, Get-Content, Set-Content</CmdletSupported> <Type> <Name>Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding</Name> </Type> <Description></Description> <PossibleValues> <PossibleValue> <Value>Unknown</Value> <Description> <para>The encoding type is unknown or invalid. The data can be treated as binary. </para> </Description> </PossibleValue> <PossibleValue> <Value>String</Value> <Description> <para>Uses the encoding type for a string.</para> </Description> </PossibleValue> <PossibleValue> <Value>Unicode</Value> <Description> <para>Encodes in UTF-16 format using the little-endian byte order. </para> </Description> </PossibleValue> <PossibleValue> <Value>Byte</Value> <Description> <para>Encodes a set of characters into a sequence of bytes. </para> </Description> </PossibleValue> <PossibleValue> <Value>BigEndianUnicode</Value> <Description> <para>Encodes in UTF-16 format using the big-endian byte order. </para> </Description> </PossibleValue> <PossibleValue> <Value>UTF8</Value> <Description> <para>Encodes in UTF-8 format.</para> </Description> </PossibleValue> <PossibleValue> <Value>UTF7</Value> <Description> <para>Encodes in UTF-7 format.</para> </Description> </PossibleValue> <PossibleValue> <Value>ASCII</Value> <Description> <para>Uses the encoding for the ASCII (7-bit) character set. </para> </Description> </PossibleValue> </PossibleValues> </DynamicParameter> <DynamicParameter> <Name>Delimiter</Name> <CmdletSupported>Get-Content</CmdletSupported> <Type> <Name>System.String</Name> </Type> <Description>Specifies the delimiter to use when reading the file. The default is "\n" (end of line).</Description> <PossibleValues> </PossibleValues> </DynamicParameter> <DynamicParameter> <Name>Wait</Name> <CmdletSupported>Get-Content</CmdletSupported> <Type> <Name>System.Management.Automation.SwitchParameter</Name> </Type> <Description>Waits for content to be appended to the file. If content is appended, it returns the appended content. If the content has changed, it returns the entire file. When waiting, Get-Content checks the file once each second until you interrupt it, such as by pressing CTRL+C.</Description> <PossibleValues> <PossibleValue> <Value></Value> <Description> <para></para> </Description> </PossibleValue> </PossibleValues> </DynamicParameter> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> <!-- v 1.1.0.9 --> <providerHelp> <Name> Function </Name> <Drives> <Para>Function:</Para> </Drives> <Synopsis> Provides access to the functions defined in Windows PowerShell. </Synopsis> <DetailedDescription> <para>The Windows PowerShell Function provider lets you get, add, change, clear, and delete the functions and filters in Windows PowerShell. A function is a named block of code that performs an action. When you type the function name, the code in the function runs. A filter is a named block of code that establishes conditions for an action. You can type the name of the filter in place of the condition, such as in a Where-Object command. In the Function: drive, functions are preceded by the label "Function" and filters are preceded by the label "Filter", but they operate properly when used in the correct context regardless of the label. The Function provider is a flat namespace that contains only the function and filter objects. Neither functions nor filters have child items. Each function is an instance of the System.Management.Automation.FunctionInfo class. Each filter is an instance of the System.Management.Automation.FilterInfo class. The examples in this section show how to manage functions, but the same methods can be used with filters. The Function provider exposes its data store in the Function: drive. To work with functions, you can change your location to the Function: drive ("set-location function:"). Or, you can work from another Windows PowerShell drive. To reference a function from another location, use the drive name (Function:) in the path. The Function provider supports all of the cmdlets whose names contain the Item noun (the Item cmdlets), except for Invoke-Item. And, it supports the Get-Content and Set-Content cmdlets. However, it does not support the cmdlets whose names contain the ItemProperty noun (the ItemProperty cmdlets), and it does not support the Filter parameter in any cmdlet. All changes to the functions affect the current console only. To save the changes, add the function to the Windows PowerShell profile, or use Export-Console to save the current console.</para> </DetailedDescription> <Capabilities> <para></para> </Capabilities> <Filters> <para></para> </Filters> <Notes> </Notes> <Tasks> <Task> <Title> Getting to the Function: Drive </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>Changes the current location to the Function: drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type "set-location c:".</para> </Introduction> <Code> set-location function: </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Getting Functions </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command gets the list of all the functions in the current session. You can use this command from any Windows PowerShell drive.</para> </Introduction> <Code> get-childitem -path function: </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets the "man" function from the Function: drive. It uses the Get-Item cmdlet to get the function. The pipeline operator (|) sends the result to Format-Table. The Wrap parameter directs text that does not fit on the line onto the next line. The Autosize parameter resizes the table columns to accommodate the text.</para> </Introduction> <Code> get-item -path man | format-table -wrap -autosize </Code> <Remarks> <para>If you are in a different drive, add the drive name (Function:) to the path.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>These commands both get the function named "c:". The first command can be used in any drive. The second command is used in the Function: drive. Because the name ends in a colon, which is the syntax for a drive, you must qualify the path with the drive name. Within the Function: drive, you can use either format. In the second command, the dot (.) represents the current location. </para> </Introduction> <Code> c:\PS> get-item -path function:c: PS Function> get-item -path .\c: </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Creating a Function </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the New-Item cmdlet to create a function called "HKLM:". The expression in braces is the script block that is represented by the function name.</para> </Introduction> <Code> new-item -path function:hklm: -value {set-location hklm:} </Code> <Remarks> <para>You can also create a function by typing it at the Windows PowerShell command line. For example, tpe "function:hklm: {set-location hklm:}". If you are in the Function: drive, you can omit the drive name. Because you cannot specify the "Filter" label in New-Item, filters are labeled as functions, but they operate properly with any label. To create a filter with the "Filter" label, type the filter at the command line. For example, type "filter:Running {$_.Status -eq "Running"}".</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command uses the New-Item cmdlet to create a function called Csrss. It uses the Options dynamic parameter to specify a value of ReadOnly for the Options property of the function.</para> </Introduction> <Code> new-item -path function: -name csrss -options readonly -value {get-process csrss} </Code> <Remarks> <para>This command works from any location. If you are in the Function: drive, you can use a dot (.) to specify the path. The dot represents the current location.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Deleting a Function </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command deletes the "hklm:" function from the current session.</para> </Introduction> <Code> remove-item function:hklm: </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command deletes all the functions from the current session except for the functions whose Options property has a value of Constant. Without the Force parameter, the command does not delete functions whose Options property has a value of ReadOnly.</para> </Introduction> <Code> remove-item function:* -force </Code> <Remarks> <para>When you delete all the functions, the command prompt changes because the prompt function, which defines the content of the command prompt, is deleted.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Displaying the Properties and Methods of Functions </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Get-Item cmdlet to get all the functions. The pipeline operator sends the results to the Get-Member cmdlet, which displays the methods and the properties of the object.</para> </Introduction> <Code> get-item -path function:* | get-member </Code> <Remarks> <para>When you pipe a collection of objects (such as the collection of functions in the Function: drive) to Get-Member, Get-Member evaluates each object in the collection separately and returns information about each object type that it finds. If all of the objects are of the same type, it returns information about the single object type. In this case, all of the functions are FunctionInfo objects. To get information about the collection of FunctionInfo objects, use the InputObject parameter of Get-Member. For example, type "get-member -InputObject (get-item function:*)". When you use the InputObject parameter, Get-Member evaluates the collection, not the objects in the collection.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command lists the values of the properties of the "prompt" function. It uses the Get-Item cmdlet to get an object that represents the "prompt" function. The pipeline operator (|) sends the results to the Format-List command. The Format-List command uses the Property parameter with a wildcard character (*) to format and to display the values of all of the properties of the "prompt" function.</para> </Introduction> <Code> get-item function:prompt | format-list -property * </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Changing the Properties of a Function </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>You can use the Set-Item cmdlet with the Options dynamic parameter to change the value of the Options property of a function. This command sets the AllScope and ReadOnly options for the "prompt" function. This command uses the Options dynamic parameter of the Set-Item cmdlet. The Options parameter is available in Set-Item only when you use it with the Alias or Function provider.</para> </Introduction> <Code> set-item -path function:prompt -options "AllScope,ReadOnly" </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command uses the Set-Item cmdlet to change the "prompt" function so that it displays the time before the path. </para> </Introduction> <Code> set-item -path function:prompt -value {'PS '+ $(Get-Date -format t) + " " + $(Get-Location) + '> '} </Code> <Remarks> <para>The change affects both the Definition and ScriptBlock properties of the FunctionInfo object. To see the effect of the change, type "get-item -path function:prompt | format-list -property *".</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command uses the Rename-Item cmdlet to change the name of the "help" function to "gh".</para> </Introduction> <Code> rename-item -path function:help -newname gh </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Copying a Function </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command copies the "prompt" function to "oldPrompt", effectively creating a new name for the script block that is associated with the prompt function. You can use this to save the original prompt function if you plan to change it. The Options property of the new function has a value of None. To change the value of the Options property, use Set-Item.</para> </Introduction> <Code> copy-item -path function:prompt -destination function:oldPrompt </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> <DynamicParameter> <Name>Options</Name> <CmdletSupported>New-Item, Set-Item</CmdletSupported> <Type> <Name>System.Management.Automation.ScopedItemOptions</Name> </Type> <Description>Determines the value of the Options property of a function.</Description> <PossibleValues> <PossibleValue> <Value>None</Value> <Description> <para>No options. "None" is the default.</para> </Description> </PossibleValue> <PossibleValue> <Value>Constant</Value> <Description> <para>The function cannot be deleted, and its properties cannot be changed. Constant is available only when you are creating a function. You cannot change the option of an existing function to Constant.</para> </Description> </PossibleValue> <PossibleValue> <Value>Private</Value> <Description> <para>The function is visible only in the current scope (not in child scopes).</para> </Description> </PossibleValue> <PossibleValue> <Value>ReadOnly</Value> <Description> <para>The properties of the function cannot be changed except by using the Force parameter. You can use Remove-Item to delete the function.</para> </Description> </PossibleValue> <PossibleValue> <Value>AllScope</Value> <Description> <para>The function is copied to any new scopes that are created.</para> </Description> </PossibleValue> </PossibleValues> </DynamicParameter> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Functions</linkText> <uri/> </navigationLink> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> <!-- v 1.1.0.9 --> <providerHelp> <Name> Registry </Name> <Drives> <Para>HKLM:, HKCU:</Para> </Drives> <Synopsis> Provides access to the system registry keys and values from Windows PowerShell. </Synopsis> <DetailedDescription> <para>The Windows PowerShell Registry provider lets you get, add, change, clear, and delete registry keys and values in Windows PowerShell. Registry keys are represented as instances of the Microsoft.Win32.RegistryKey class. Registry values are represented as instances of the PSCustomObject class. The Registry provider lets you access a hierarchical namespace that consists of registry keys and subkeys. Registry values and data are not components of that hierarchy. Instead, they are properties of each of the keys. The Registry provider supports all the cmdlets that contain the Item noun (the Item cmdlets), such as Get-Item, Copy-Item, and Rename Item. Use the Item cmdlets when you work with registry keys and subkeys. The Registry provider also supports the cmdlets that contain the ItemProperty noun (the ItemProperty cmdlets). Use the ItemProperty cmdlets when you work with registry values and data. You cannot use the cmdlets that contain the Content noun (the Content cmdlets) with the Registry provider. Each registry key is protected by a security descriptor. You can use Get-Acl to view the security descriptor of a key.</para> </DetailedDescription> <Capabilities> <para>ShouldProcess</para> </Capabilities> <Filters> <para></para> </Filters> <Notes> </Notes> <Tasks> <Task> <Title> Navigating the Registry </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command sets the current location to the HKEY_LOCAL_MACHINE\Software registry key:</para> </Introduction> <Code> set-location hklm:\software </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command displays the current location:</para> </Introduction> <Code> get-location </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Managing Registry Keys </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command displays information about each immediate subkey of the HKEY_LOCAL_MACHINE\Software registry key:</para> </Introduction> <Code> get-childitem -path hklm:\software </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command creates the TestNew subkey under the HKCU:\Environment subkey:</para> </Introduction> <Code> new-item -path hkcu:\Environment\TestNew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command removes the TestNew subkey of the HKEY_CURRENT_USER\Environment key:</para> </Introduction> <Code> remove-item -path hkcu:\Environment\TestNew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 4 -------------------------- </Title> <Introduction> <para>This command copies the TestNew key to the TestCopy subkey: </para> </Introduction> <Code> copy-item -path hkcu:\Environment\TestNew hkcu:\Environment\TestNew\TestCopy </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 5 -------------------------- </Title> <Introduction> <para>This command displays information about all the subkeys of the HKEY_LOCAL_MACHINE\Software registry key:</para> </Introduction> <Code> get-childitem -path hklm:\Software -recurse </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 6 -------------------------- </Title> <Introduction> <para>This command moves the HKEY_CURRENT_USER\Environment\testnewcopy registry key, its properties, and all its subkeys and their properties to HKEY_CURRENT_USER\Environment\testnew:</para> </Introduction> <Code> move-item -path hkcu:\environment\testnewcopy ` -destination hkcu:\environment\testnew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 7 -------------------------- </Title> <Introduction> <para>This command renames the HKEY_CURRENT_USER\Environment\testnew registry key to HKEY_CURRENT_USER\Environment\test:</para> </Introduction> <Code> rename-item -path hkcu:\environment\testnew\ -newname test </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 8 -------------------------- </Title> <Introduction> <para>This command displays the security descriptor for the specified registry item:</para> </Introduction> <Code> get-acl -path hkcu:\environment\testnew | format-list -property * </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Managing Registry Entries </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command displays the value name and value data for each registry entry in the HKEY_CURRENT_USER\Environment registry key: </para> </Introduction> <Code> get-itemproperty -path hkcu:\Environment </Code> <Remarks> <para>The Default registry entry is returned only if it has a value.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command displays the value name and value data for the Temp registry entry in the HKEY_CURRENT_USER\Environment registry key:</para> </Introduction> <Code> get-itemproperty -path hkcu:\Environment -name Temp </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command creates the pstest registry entry in the HKEY_CURRENT_USER key and sets its value to pstestvalue:</para> </Introduction> <Code> new-itemproperty -path hkcu:\environment -name "pstest" -value "pstestvalue" </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 4 -------------------------- </Title> <Introduction> <para>This command updates the value of the pstest registry entry to updatedvalue in the HKEY_CURRENT_USER\Environment key:</para> </Introduction> <Code> set-itemproperty -path hkcu:\environment -name pstest -value "updatedvalue" </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 5 -------------------------- </Title> <Introduction> <para>This command renames the value name of the pstest registry entry to pstestnew in the HKEY_CURRENT_USER\Environment key:</para> </Introduction> <Code> rename-itemproperty -path hkcu:\environment -name pstest ` -newname pstestnew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 6 -------------------------- </Title> <Introduction> <para>This command copies the pstestnew registry entry from the HKEY_CURRENT_USER\Environment key to the HKEY_CURRENT_USER\Environment\testnewcopy key:</para> </Introduction> <Code> copy-itemproperty -path hkcu:\environment ` -destination hkcu:\environment\testnewcopy -name pstestnew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 7 -------------------------- </Title> <Introduction> <para>The command moves the pstestnew registry entry from the HKEY_CURRENT_USER\environment\testnewcopy key to the HKEY_CURRENT_USER\environment\testnew key:</para> </Introduction> <Code> move-itemproperty -path hkcu:\environment\testnewcopy ' -destination hkcu:\environment\testnew -name pstestnew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 8 -------------------------- </Title> <Introduction> <para>This command clears the value of the pstestnew registry entry in the HKEY_CURRENT_USER\Environment\testnew key:</para> </Introduction> <Code> clear-itemproperty -path hkcu:\environment\testnew -name pstestnew </Code> <Remarks> <para>You can use the Clear-Item cmdlet to clear the value of the default registry entry for a subkey. For example, the following command clears the value of the default entry of the HKEY_CURRENT_USER\Environment\testnew registry key: clear-item -path hkcu:\environment\testnew</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 9 -------------------------- </Title> <Introduction> <para>This command removes the pstestnew registry entry from the HKEY_CURRENT_USER\Environment\testnew registry key:</para> </Introduction> <Code> remove-itemproperty -path hkcu:\environment\testnew ` -name pstestnew </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 10 -------------------------- </Title> <Introduction> <para>This command updates the value of the default registry entry in the HKEY_CURRENT_USER\Environment\testnew key to "default value":</para> </Introduction> <Code> set-itemproperty -path hkcu:\environment\testnew ` -name "(default)" -value "default value" </Code> <Remarks> <para>You can also update the default value of a registry key by using the Set-Item cmdlet. For example, the following command updates the default value of the testnew key: set-item -path hkcu:\environment\testnew -value "another default value"</para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> <DynamicParameter> <Name>Type</Name> <CmdletSupported>Set-Item</CmdletSupported> <Type> <Name>Microsoft.Win32.RegistryValueKind</Name> </Type> <Description>Specifies the data types to use when storing values in the registry, or identifies the data type of a value in the registry.</Description> <PossibleValues> <PossibleValue> <Value>String</Value> <Description> <para>Specifies a null-terminated string. Equivalent to REG_SZ.</para> </Description> </PossibleValue> <PossibleValue> <Value>ExpandString</Value> <Description> <para>Specifies a null-terminated string that contains unexpanded references to environment variables that are expanded when the value is retrieved. Equivalent to REG_EXPAND_SZ.</para> </Description> </PossibleValue> <PossibleValue> <Value>Binary</Value> <Description> <para>Specifies binary data in any form. Equivalent to REG_BINARY.</para> </Description> </PossibleValue> <PossibleValue> <Value>DWord</Value> <Description> <para>Specifies a 32-bit binary number. Equivalent to REG_DWORD.</para> </Description> </PossibleValue> <PossibleValue> <Value>MultiString</Value> <Description> <para>Specifies an array of null-terminated strings terminated by two null characters. Equivalent to REG_MULTI_SZ.</para> </Description> </PossibleValue> <PossibleValue> <Value>QWord</Value> <Description> <para>Specifies a 64-bit binary number. Equivalent to REG_QWORD.</para> </Description> </PossibleValue> <PossibleValue> <Value>Unknown</Value> <Description> <para>Indicates an unsupported registry data type, such as REG_RESOURCE_LIST.</para> </Description> </PossibleValue> </PossibleValues> </DynamicParameter> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> <!-- v 1.1.0.9 --> <providerHelp> <Name> Variable </Name> <Drives> <Para>Variable:</Para> </Drives> <Synopsis> Provides access to the Windows PowerShell variables and to their values. </Synopsis> <DetailedDescription> <para>The Windows PowerShell Variable provider lets you get, add, change, clear, and delete Windows PowerShell variables in the current console. The Windows PowerShell Variable provider supports the variables that Windows PowerShell creates, including the automatic variables, the preference variables, and the variables that you create. The Variable provider is a flat namespace that contains only the variable objects. The variables have no child items. Most of the variables are instances of the System.Management.Automation.PSVariable class. However, there are some variations. For example, the "?" variable is a member of the QuestionMarkVariable class, and the "MaximumVariableCount" variable is a member of the SessionStateCapacityVariable class. The Variable provider exposes its data store in the Variable: drive. To work with variables, you can change your location to the Variable: drive ("set-location variable:"), or you can work from any other Windows PowerShell drive. To reference a variable from another location, use the drive name (Variable:) in the path. Windows PowerShell includes a set of cmdlets designed especially to view and to change variables: -- Get-Variable -- New-Variable -- Set-Variable -- Remove-Variable -- Clear-Variable When you use these cmdlets, you do not need to specify the Variable: drive in the name. The Variable provider supports all of the cmdlets whose names contain the Item noun (the Item cmdlets), except for Invoke-Item. The Variable provider supports the Get-Content and Set-Content cmdlets. However, it does not support the cmdlets whose names contain the ItemProperty noun (the ItemProperty cmdlets), and it does not support the Filter parameter in any cmdlet. You can also use the Windows PowerShell expression parser to create, view, and change the values of variables without using the cmdlets. When working with variables directly, use a dollar sign ($) to identify the name as a variable and the assignment operator (=) to establish and change its value. For example, "$p = get-process" creates the "p" variable and stores the results of a "get-process" command in it. All changes to the variables affect the current session only. To save the changes, add the changes to the Windows PowerShell profile, or use Export-Console to save the current console.</para> </DetailedDescription> <Capabilities> <para></para> </Capabilities> <Filters> <para></para> </Filters> <Notes> The Variable provider does not support any dynamic parameters. </Notes> <Tasks> <Task> <Title> Getting to the Variable: Drive </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command changes the current location to the Variable: drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type "set-location c:".</para> </Introduction> <Code> set-location variable: </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Displaying the Value of Variables </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command gets the list of all the variables and their values in the current session. You can use this command from any Windows PowerShell drive.</para> </Introduction> <Code> get-childitem -path variable: </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command gets the variables with names that begin with "max". You can use this command from any Windows PowerShell drive.</para> </Introduction> <Code> get-childitem -path variable:max* </Code> <Remarks> <para>If you are in the Variable: drive, you can omit the drive name from the path.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command gets the value of the WhatIfPreference variable by typing it at the command line. The name of the variable is preceded by a dollar sign ($) to indicate that it is a variable. The Variable: drive name is not specified.</para> </Introduction> <Code> $WhatIfPreference </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 4 -------------------------- </Title> <Introduction> <para>This command uses the LiteralPath parameter of Get-ChildItem to get the value of the "?" variable from within the Variable: drive. Get-ChildItem does not attempt to resolve any wildcards in the values of the LiteralPath parameter.</para> </Introduction> <Code> get-childitem -literalpath ? </Code> <Remarks> <para>To display the value of a variable with a special character name without a cmdlet, type a dollar sign ($) and the variable name. For example, to display the value of the "?" variable, type "$?".</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 5 -------------------------- </Title> <Introduction> <para>This command gets the variables that have the values of "ReadOnly" or "Constant" for their Options property.</para> </Introduction> <Code> get-childitem -path variable: | where-object {$_.options -match "Constant" -or $_.options -match "ReadOnly"} | format-list -property name, value, options </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Creating a New Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command creates the "services" variable and stores the results of a Get-Service command in it. Because the current location is in the Variable: drive, the value of the Path parameter is a dot (.), which represents the current location. The parentheses around the Get-Service command ensure that the command is executed before the variable is created. Without the parentheses, the value of the new variable is a "Get-Service" string.</para> </Introduction> <Code> new-item -path . -name services -value (Get-Service) </Code> <Remarks> <para>If you are not in the variable: drive, include the Variable: drive name in the path.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command creates a "services" variable and stores the result of a Get-Service command in it. The command uses a dollar sign ($) to indicate a variable and the assignment operator (=) to assign the result of the Get-Service command to the newly created variable.</para> </Introduction> <Code> $services = Get-Service </Code> <Remarks> <para>To create a variable without a value, omit the assignment operator.</para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Displaying the Properties and Methods of Variables </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Get-Item cmdlet to get all variables. The pipeline operator (|) sends the results to the Get-Member cmdlet, which displays the methods and properties of the object.</para> </Introduction> <Code> get-item -path variable:* | get-member </Code> <Remarks> <para>When you pipe a collection of objects (such as the collection of variables in the Variable: drive) to Get-Member, Get-Member evaluates each object in the collection separately and returns information about each of the object types that it finds. To get information about the collection of objects in the Variable: drive, use the InputObject parameter of Get-Member. For example, "get-member -inputobject (get-item variable:*)". When you use InputObject, Get-Member evaluates the collection, not the objects in the collection.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command lists the values of the properties of the "home" variable. It uses the Get-Item cmdlet to get an object that represents the "home" variable. The pipeline operator (|) sends the results to the Format-List command. The Format-List command uses the Property parameter with a wildcard character (*) to format and to display the values of all of the properties of the "home" variable.</para> </Introduction> <Code> get-item variable:home | format-list -property * </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Changing the Properties of a Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Rename-Item cmdlet to change the name of the "a" variable to "processes".</para> </Introduction> <Code> rename-item -path variable:a -newname processes </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command uses the Set-Item cmdlet to change the value of the ErrorActionPreference variable to "Stop".</para> </Introduction> <Code> set-item -path variable:ErrorActionPreference -value Stop </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 3 -------------------------- </Title> <Introduction> <para>This command changes the value of the ErrorActionPreference variable to "Stop". It uses a dollar sign ($) to indicate a variable and the assignment operator (=) to assign the value.</para> </Introduction> <Code> $ErrorActionPreference = Stop </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Copying a Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Copy-Item cmdlet to copy the "processes" variable to "old_processes". This creates a new variable named "old_processes" that has the same value as the "processes" variable.</para> </Introduction> <Code> copy-item -path variable:processes -destination variable:old_processes </Code> <Remarks> <para>If the command is issued from within the Variable: drive, you can omit the drive name from the value of the Path parameter.</para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command copies the "processes" variable to "old_processes" without using a cmdlet. It uses the dollar sign ($) to indicate variables and the assignment operator to assign the value of $processes to old_processes. </para> </Introduction> <Code> $old_processes = $processes </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Deleting a Variable </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command deletes the "serv" variable from the current session. You can use this command in any Windows PowerShell drive.</para> </Introduction> <Code> remove-variable -path variable:serv </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command deletes all variables from the current session except for the variables whose Options property has a value of Constant. Without the Force parameter, the command does not delete variables whose Options property has a value of ReadOnly.</para> </Introduction> <Code> remove-item variable:* -force </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> <Task> <Title> Setting the Value of a Variable to NULL </Title> <Description> <para></para> </Description> <Examples> <Example> <Title> -------------------------- EXAMPLE 1 -------------------------- </Title> <Introduction> <para>This command uses the Clear-Item cmdlet to change the value of the "processes" variable to NULL.</para> </Introduction> <Code> clear-item -path variable:processes </Code> <Remarks> <para></para> </Remarks> </Example> <Example> <Title> -------------------------- EXAMPLE 2 -------------------------- </Title> <Introduction> <para>This command clears the value of the "processes" variable by assigning a null value to it. It uses the $null automatic variable to represent the NULL value.</para> </Introduction> <Code> $processes = $null </Code> <Remarks> <para></para> </Remarks> </Example> </Examples> </Task> </Tasks> <DynamicParameters> </DynamicParameters> <RelatedLinks> <navigationLink> <linkText>about_Variables</linkText> <uri/> </navigationLink> <navigationLink> <linkText>about_Automatic_Variables</linkText> <uri/> </navigationLink> <navigationLink> <linkText>about_Providers</linkText> <uri/> </navigationLink> </RelatedLinks> </providerHelp> </helpItems>