Skip to content

Commit aedd0a6

Browse files
authored
Support for working with remote modules (#361)
When previously cmdlets from remote runspace (Import-PSSession) got used, they didn't have the correct command object metadata for reflection. The meat of this change is adding MyGetCommand that proxies nessesary calls to remote runspace. There are no assumption about the remote runspace except the fact that Select-Object cmdlet should be present there. The NoLanguage mode in remote runspace is supported. NoLanguage mode is nessesary for products like Exchange and Office 365. - Add MyGetCommand - Fix the getTypeString calls for remoting - Add -Session parameter to New-MarkdownHelp, Update-MarkdownHelp, Update-MarkdownHelpModule
1 parent eb498d4 commit aedd0a6

File tree

5 files changed

+303
-58
lines changed

5 files changed

+303
-58
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ Supported scenarios:
105105

106106
* Preview help from generated maml file.
107107

108-
* Update the [schema](platyPS.schema.md) of existing PlatyPS generated markdown files (Currently version 1.0.0 to version 2.0.0)
108+
## Remoting
109+
110+
PlatyPS supports working with [`Import-PSSession`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-6) aka implicit remoting.
111+
Just pass `-Session $Session` parameter to the platyPS cmdlets and it will do the rest.
109112

110113
## Build
111114

docs/New-MarkdownHelp.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ Creates help in markdown format.
1414

1515
### FromModule
1616
```
17-
New-MarkdownHelp -Module <String[]> [-Force] [-AlphabeticParamsOrder] [-Metadata <Hashtable>]
18-
-OutputFolder <String> [-NoMetadata] [-UseFullTypeName] [-Encoding <Encoding>] [-WithModulePage]
19-
[-Locale <String>] [-HelpVersion <String>] [-FwLink <String>] [<CommonParameters>]
17+
New-MarkdownHelp -Module <String[]> [-Session <PSSession>] [-Force] [-AlphabeticParamsOrder]
18+
[-Metadata <Hashtable>] -OutputFolder <String> [-NoMetadata] [-UseFullTypeName] [-Encoding <Encoding>]
19+
[-WithModulePage] [-Locale <String>] [-HelpVersion <String>] [-FwLink <String>] [<CommonParameters>]
2020
```
2121

2222
### FromCommand
2323
```
24-
New-MarkdownHelp -Command <String[]> [-Force] [-AlphabeticParamsOrder] [-Metadata <Hashtable>]
25-
[-OnlineVersionUrl <String>] -OutputFolder <String> [-NoMetadata] [-UseFullTypeName] [-Encoding <Encoding>]
26-
[<CommonParameters>]
24+
New-MarkdownHelp -Command <String[]> [-Session <PSSession>] [-Force] [-AlphabeticParamsOrder]
25+
[-Metadata <Hashtable>] [-OnlineVersionUrl <String>] -OutputFolder <String> [-NoMetadata] [-UseFullTypeName]
26+
[-Encoding <Encoding>] [<CommonParameters>]
2727
```
2828

2929
### FromMaml
@@ -443,6 +443,23 @@ Accept pipeline input: False
443443
Accept wildcard characters: False
444444
```
445445
446+
### -Session
447+
Provides support for remote commands.
448+
Pass the session that you used to create the commands with `Import-PSSession`.
449+
This is required to get accurate parameters metadata from the remote session.
450+
451+
```yaml
452+
Type: PSSession
453+
Parameter Sets: FromModule, FromCommand
454+
Aliases:
455+
456+
Required: False
457+
Position: Named
458+
Default value: None
459+
Accept pipeline input: False
460+
Accept wildcard characters: False
461+
```
462+
446463
### CommonParameters
447464
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
448465

docs/Update-MarkdownHelp.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Update PlatyPS markdown help files.
1414

1515
```
1616
Update-MarkdownHelp [-Path] <String[]> [[-Encoding] <Encoding>] [[-LogPath] <String>] [-LogAppend]
17-
[-AlphabeticParamsOrder] [-UseFullTypeName] [<CommonParameters>]
17+
[-AlphabeticParamsOrder] [-UseFullTypeName] [-Session <PSSession>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -173,6 +173,23 @@ Accept pipeline input: False
173173
Accept wildcard characters: False
174174
```
175175
176+
### -Session
177+
Provides support for remote commands.
178+
Pass the session that you used to create the commands with `Import-PSSession`.
179+
This is required to get accurate parameters metadata from the remote session.
180+
181+
```yaml
182+
Type: PSSession
183+
Parameter Sets: (All)
184+
Aliases:
185+
186+
Required: False
187+
Position: Named
188+
Default value: None
189+
Accept pipeline input: False
190+
Accept wildcard characters: False
191+
```
192+
176193
### CommonParameters
177194
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
178195

docs/Update-MarkdownHelpModule.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Update all files in a markdown help module folder.
1414

1515
```
1616
Update-MarkdownHelpModule [-Path] <String[]> [[-Encoding] <Encoding>] [-RefreshModulePage]
17-
[[-LogPath] <String>] [-LogAppend] [-AlphabeticParamsOrder] [<CommonParameters>]
17+
[[-LogPath] <String>] [-LogAppend] [-AlphabeticParamsOrder] [-Session <PSSession>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -150,6 +150,23 @@ Accept pipeline input: False
150150
Accept wildcard characters: False
151151
```
152152
153+
### -Session
154+
Provides support for remote commands.
155+
Pass the session that you used to create the commands with `Import-PSSession`.
156+
This is required to get accurate parameters metadata from the remote session.
157+
158+
```yaml
159+
Type: PSSession
160+
Parameter Sets: (All)
161+
Aliases:
162+
163+
Required: False
164+
Position: Named
165+
Default value: None
166+
Accept pipeline input: False
167+
Accept wildcard characters: False
168+
```
169+
153170
### CommonParameters
154171
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
155172

0 commit comments

Comments
 (0)