Skip to content

Commit 0d1d533

Browse files
authored
Merge pull request MicrosoftDocs#2955 from ptorr-msft/main
Update Invoke-CommandInDesktopPackage.md
2 parents 137c8e1 + 61bbd76 commit 0d1d533

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

docset/winserver2022-ps/appx/Invoke-CommandInDesktopPackage.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.
2+
description: A debugging tool that creates a new process in the context of a packaged app.
33
external help file: Microsoft.Windows.Appx.PackageManager.Commands.dll-Help.xml
44
Module Name: Appx
55
ms.date: 05/19/2017
@@ -11,51 +11,60 @@ title: Invoke-CommandInDesktopPackage
1111
# Invoke-CommandInDesktopPackage
1212

1313
## SYNOPSIS
14-
Runs a command in the context of a specified app package.
14+
A debugging tool that creates a new process in the context of a packaged app.
1515

1616
## SYNTAX
1717

1818
```
19-
Invoke-CommandInDesktopPackage [-PackageFamilyName] <String> [[-AppId] <String>] [-Command] <String>
19+
Invoke-CommandInDesktopPackage [-PackageFamilyName] <String> [-AppId] <String> [-Command] <String>
2020
[[-Args] <String>] [-PreventBreakaway] [<CommonParameters>]
2121
```
2222

2323
## DESCRIPTION
24-
**Invoke-CommandInDesktopPackage** will have a package token and identity. It's primarily designed to be used as a debugging utility.
24+
`Invoke-CommandInDesktopPackage` creates a new process in the context of the supplied **PackageFamilyName** and **AppId**.
25+
26+
The created process will have the identity of the provided **AppId** and will have access to its virtualized file system and registry (if any). The new process will have a token that is similar to, but not identical to, a real **AppId** process.
27+
28+
The primary use-case of this command is to invoke debugging or troubleshooting tools in the context of the packaged app to easily access its virtualized resources. For example, you can run the Registry Editor to see virtualized registry keys, or Notepad to read virtualized files. See the important note that follows on using tools such as the Registry Editor that require elevation.
29+
30+
No guarantees are made about the behavior of the created process, other than it having the package identity and access to the package's virtualized resources. In particular, the new process will _not_ be created in an AppContainer even if an **AppId** process would normally be created in an AppContainer. Features such as Privacy Controls or other App Settings may or may not apply to the new process. You should not rely on any specific side-effects of using this command, as they are undefined and subject to change.
2531

2632
## EXAMPLES
2733

28-
### Example 1: Invoke an executable from app package
34+
### Example 1: Invoke Notepad to read virtualized files
35+
36+
The following command invokes Notepad in the context of the `ContosoApp` app from the `Contoso.MyApp` package. This allows you to access resources such as a log file or configuration file stored in the app's virtualized filesystem.
37+
2938
```
30-
PS C:\> Invoke-CommandInDesktopPackage -AppId "AppPackage1" -PackageFamilyName "29270sandstorm.AppPackage1_gah1vdar1nn7a" -Command "demo.exe"
39+
PS C:\> Invoke-CommandInDesktopPackage -AppId "ContosoApp" -PackageFamilyName "Contoso.MyApp_abcdefgh23456" -Command "notepad.exe"
3140
```
3241

33-
This command invokes the demo.exe that can be found in '29270sandstorm.AppPackage1_gah1vdar1nn7a' app package under the 'AppPackage1' Application element.
42+
3443

3544
## PARAMETERS
3645

3746
### -AppId
38-
AppId is the Application ID from the package manifest.
47+
**AppId** is the Application ID from the target package's manifest.
3948

40-
41-
42-
<Application Id="blah" ... />
49+
```XML
50+
<Application Id="MyAppName" ... />
4351
</Application>
52+
```
4453

4554
```yaml
4655
Type: String
4756
Parameter Sets: (All)
4857
Aliases:
4958

50-
Required: False
59+
Required: True
5160
Position: 2
5261
Default value: None
5362
Accept pipeline input: True (ByPropertyName, ByValue)
5463
Accept wildcard characters: False
5564
```
5665
5766
### -Args
58-
Optional arguments that should be passed to the Command (e.g. "/od")
67+
Optional arguments to be passed to the new process (for example, "/foo /bar")
5968
6069
```yaml
6170
Type: String
@@ -70,7 +79,9 @@ Accept wildcard characters: False
7079
```
7180
7281
### -Command
73-
An executable to invoke (e.g. "cmd.exe")
82+
An executable to invoke (for example, `regedit.exe`).
83+
84+
Note that if the executable requires elevation (like `regedit`), you must call `Invoke-CommandInDesktopPackage` from an already-elevated context. Calling `Invoke-CommandInDesktopPackage` from a non-elevated context does not work as expected. The new process is created without the package context, and the PowerShell command fails.
7485

7586
```yaml
7687
Type: String
@@ -85,7 +96,7 @@ Accept wildcard characters: False
8596
```
8697

8798
### -PackageFamilyName
88-
Family Name of the package. You can retrieve this by calling [Get-AppxPackage](./Get-AppxPackage.md).
99+
The Package Family Name of the target package. You can retrieve this by calling [Get-AppxPackage](./Get-AppxPackage.md).
89100

90101
```yaml
91102
Type: String
@@ -100,7 +111,7 @@ Accept wildcard characters: False
100111
```
101112

102113
### -PreventBreakaway
103-
Switch that causes the entire process tree to stay in the package context.
114+
Causes all child processes of the invoked process to also be created in the context of the **AppId**. By default, child processes are created without any context. This switch is useful for running `cmd.exe` so that you can launch multiple other tools in the package context.
104115

105116
```yaml
106117
Type: SwitchParameter

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy