Skip to content

Commit 33b2c13

Browse files
v3.1.0
1 parent 5ea2bb5 commit 33b2c13

16 files changed

+549
-112
lines changed

PSRemoteOperations.psd1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
RootModule = ""
99

1010
# Version number of this module.
11-
ModuleVersion = '3.0.0'
11+
ModuleVersion = '3.1.0'
1212

1313
# Supported PSEditions
1414
CompatiblePSEditions = @("Desktop","Core")
@@ -23,7 +23,7 @@ Author = 'Jeff Hicks'
2323
CompanyName = 'JDH Information Technology Solutions, Inc.'
2424

2525
# Copyright statement for this module
26-
Copyright = '(c) 2018 JDH Information Technology Solutions, Inc. All rights reserved.'
26+
Copyright = '(c) 2018-2019 JDH Information Technology Solutions, Inc. All rights reserved.'
2727

2828
# Description of the functionality provided by this module
2929
Description = 'A PowerShell module for executing commands remotely in a non-remoting environment.'
@@ -70,7 +70,8 @@ else {
7070
}
7171

7272
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
73-
FunctionsToExport = @('New-PSRemoteOperation','Invoke-PSRemoteOperation','Get-PSRemoteOperationResult','Register-PSRemoteOperationWatcher')
73+
FunctionsToExport = @('New-PSRemoteOperation', 'Invoke-PSRemoteOperation', 'Get-PSRemoteOperationResult', 'Register-PSRemoteOperationWatcher',
74+
'Wait-PSRemoteOperation')
7475

7576
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
7677
CmdletsToExport = ''

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PSRemoteOperations
22

3-
This PowerShell module is designed to run commands on remote computers but without using PowerShell remoting. It takes advantage of cloud services like DropBox and OneDrive. The idea is that you create a file with instructions on a command to run. The file includes the target computer name. The remote computer is monitoring the folder and when a matching file is detected the operation is invoked.
3+
This PowerShell module is designed to run commands on remote computers but _without_ using PowerShell remoting. It takes advantage of cloud services like Dropbox and OneDrive. The central concept is that you create a file with instructions about a command to run on a remote or target computer. The file includes the target computer name. The remote computer is monitoring a shared folder and when a matching file is detected the operation is invoked. The shared or common folder is managed by whatever cloud or other service of your choice.
44

55
You can install the latest version from the PowerShell Gallery:
66

@@ -16,9 +16,10 @@ Or check out the individual commands:
1616
+ [Invoke-PSRemoteOperation](docs/Invoke-PSRemoteOperation.md)
1717
+ [New-PSRemoteOperation](docs/New-PSRemoteOperation.md)
1818
+ [Register-PSRemoteOperationWatcher](docs/Register-PSRemoteOperationWatcher.md)
19+
+ [Wait-PSRemoteOperation](docs/Wait-PSRemoteOperation.md)
1920

2021
## Cross-Platform and PowerShell Core
2122

2223
The long-term goal is to ensure that this module will work cross-platform and in PowerShell Core. Basic functionality should exist running this module on PowerShell Core, both in Windows and non-Windows environments. Support for CMS messages is limited to Windows platforms through the use of dynamic parameters. `Register-PSRemoteOperationWatcher` requires a Windows platform but should work under PowerShell Core. For non-Windows systems, you will have to come up with your own tooling for monitoring and execution using `Invoke-PSRemoteOperation`.
2324

24-
*last updated 22 October 2018*
25+
Last updated 2019-07-31 17:39:11Z UTC

autocompleters.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
Register-ArgumentCompleter -CommandName Get-PSRemoteOperationResult, New-PSRemoteOperation -ParameterName Computername -ScriptBlock {
33
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
44

5-
$names = (get-childitem -Path $PSRemoteOpArchive | Split-Path -leaf).foreach( {$_.split("_")[0].toUpper()}) | Get-Unique
5+
$names = (Get-ChildItem -Path $PSRemoteOpArchive | Split-Path -leaf).foreach( { $_.split("_")[0].toUpper() }) | Get-Unique
66

77
if ($wordToComplete) {
8-
$fill = $names | where-object {$_ -match "$wordToComplete" }
8+
$fill = $names | Where-Object { $_ -match "$wordToComplete" }
99
}
1010
else {
1111
$fill = $names
1212
}
13-
$fill | ForEach-Object {
13+
$fill | ForEach-Object {
1414
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
1515
}
1616
}
1717

1818
Register-ArgumentCompleter -CommandName New-PSRemoteOperation -ParameterName To -ScriptBlock {
1919
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
2020

21-
(get-childitem -Path Cert:\CurrentUser\my -DocumentEncryptionCert).Subject |
22-
ForEach-Object {
21+
(Get-ChildItem -Path Cert:\CurrentUser\my -DocumentEncryptionCert).Subject |
22+
ForEach-Object {
2323
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
2424
}
2525
}

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log for PSRemoteOperations
22

3+
## v3.1.0
4+
5+
+ Fixed bug using CMS messages with a dynamic parameter
6+
+ Fixed pester tests to accommodate sub-modules
7+
+ Modified code to use `[void]` in place of `Out-Null`
8+
+ All `-Computername` parameters now support an alias of `-cn`
9+
+ Added `Wait-PSRemoteOperation` (Issue #10)
10+
+ Updated help documentation. Online links now point to markdown files in the Github repository.
11+
+ Updated `README.md`
12+
313
## v3.0.0
414

515
+ restructured module to support Core and Windows through nested modules. (Issue #9)

docs/Get-PSRemoteOperationResult.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSRemoteOperations-help.xml
33
Module Name: PSRemoteOperations
4-
online version:
4+
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Get-PSRemoteOperationResult.md
55
schema: 2.0.0
66
---
77

@@ -65,7 +65,7 @@ Enter a computername to filter on.
6565
```yaml
6666
Type: String
6767
Parameter Sets: (All)
68-
Aliases:
68+
Aliases: cn
6969

7070
Required: False
7171
Position: Named
@@ -112,4 +112,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
112112
113113
[Invoke-PSRemoteOperation](./Invoke-PSRemoteOperation)
114114
115-
[New-PSRemoteOperation](./New-PSRemoteOperation)
115+
[New-PSRemoteOperation](./New-PSRemoteOperation)

docs/Invoke-PSRemoteOperation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSRemoteOperations-help.xml
33
Module Name: PSRemoteOperations
4-
online version:
4+
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Invoke-PSRemoteOperation.md
55
schema: 2.0.0
66
---
77

@@ -28,7 +28,7 @@ Normally, this command will be called by a remote operation watcher job or simil
2828
### Example 1
2929

3030
```powershell
31-
PS C:\> $file = Get-Childitem $PSRemoteOpPath\*.psd1 | where-object {$_.name -match "^$($env:Computername)"}
31+
PS C:\> $file = Get-ChildItem $PSRemoteOpPath\*.psd1 | Where-Object {$_.name -match "^$($env:Computername)"}
3232
PS C:\> Invoke-PSRemoteOperation $file
3333
```
3434

@@ -122,4 +122,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
122122
123123
[New-PSRemoteOperation](./New-PSRemoteOperation)
124124
125-
[Get-PSRemoteOperationResult](./Get-PSRemoteOperationResult])
125+
[Get-PSRemoteOperationResult](./Get-PSRemoteOperationResult])

docs/New-PSRemoteOperation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSRemoteOperations-help.xml
33
Module Name: PSRemoteOperations
4-
online version:
4+
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/New-PSRemoteOperation.md
55
schema: 2.0.0
66
---
77

@@ -118,7 +118,7 @@ Enter the name or names of the computer where this command will execute.
118118
```yaml
119119
Type: String[]
120120
Parameter Sets: (All)
121-
Aliases: CN
121+
Aliases: cn
122122

123123
Required: True
124124
Position: 0
@@ -279,4 +279,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
279279
280280
[Register-PSRemoteOperationWatcher](./Register-PSRemoteOperationWatcher)
281281
282-
[Protect-CmsMessage](http://go.microsoft.com/fwlink/?LinkId=821716)
282+
[Protect-CmsMessage](http://go.microsoft.com/fwlink/?LinkId=821716)

docs/Register-PSRemoteOperationWatcher.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSRemoteOperations-help.xml
33
Module Name: PSRemoteOperations
4-
online version:
4+
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Register-PSRemoteOperationWatcher.md
55
schema: 2.0.0
66
---
77

@@ -47,7 +47,7 @@ Create a scheduled job called Watch. This job is using the user defined defaults
4747
PS C:\> Unregister-Scheduledjob watch
4848
```
4949

50-
Use the PowerShell scheduledjob cmdlets to remove the watcher job.
50+
Use the PowerShell scheduled job cmdlets to remove the watcher job.
5151

5252
## PARAMETERS
5353

@@ -203,4 +203,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
203203
204204
[New-PSRemoteOperation](./New-PSRemoteOperation)
205205
206-
[Register-ScheduledJob](http://go.microsoft.com/fwlink/?LinkId=821702)
206+
[Register-ScheduledJob](http://go.microsoft.com/fwlink/?LinkId=821702)

docs/Wait-PSRemoteOperation.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
external help file: PSRemoteOperations-help.xml
3+
Module Name: PSRemoteOperations
4+
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Wait-PSRemoteOperation.md
5+
schema: 2.0.0
6+
---
7+
8+
# Wait-PSRemoteOperation
9+
10+
## SYNOPSIS
11+
12+
Wait for a PSRemoteOperation to complete.
13+
14+
## SYNTAX
15+
16+
### folder (Default)
17+
18+
```yaml
19+
Wait-PSRemoteOperation [-Path <String>] [-Computername <String>] [-Timeout <Int32>] [<CommonParameters>]
20+
```
21+
22+
### file
23+
24+
```yaml
25+
Wait-PSRemoteOperation [[-FilePath] <String>] [-Timeout <Int32>] [<CommonParameters>]
26+
```
27+
28+
## DESCRIPTION
29+
30+
Most of the time remote operations are intended to be run asynchronously in much the same way that you use Start-Job. But there my be situations where you want to wait for a remote operation to complete. This command will pause your PowerShell prompt until the job completes or a timeout value has been exceeded.
31+
32+
This command does not write any results to the pipeline.
33+
34+
## EXAMPLES
35+
36+
### Example 1
37+
38+
```powershell
39+
PS C:\> New-PSRemoteOperation -scriptblock { get-process | export-clixml c:\shared\proc.xml} -computername SRV1 -passthru | Wait-PSRemoteOperation
40+
```
41+
42+
This example will create a new PSRemote operation which passes the resulting .psd1 file to Wait-PSRemoteOperation.
43+
44+
### Example 2
45+
46+
```powershell
47+
PS C:\> Wait-PSRemoteOperation -computername SRV2 -timeout 30
48+
```
49+
50+
Watch the $PSRemoteOpPath folder for a job targeted to SRV2 but timeout waiting after 30 seconds.
51+
52+
## PARAMETERS
53+
54+
### -Computername
55+
56+
Wait for results from a specific computer
57+
58+
```yaml
59+
Type: String
60+
Parameter Sets: folder
61+
Aliases: cn
62+
63+
Required: False
64+
Position: Named
65+
Default value: None
66+
Accept pipeline input: False
67+
Accept wildcard characters: False
68+
```
69+
70+
### -FilePath
71+
72+
Specify the path to a PSRemoteOperation file.
73+
74+
```yaml
75+
Type: String
76+
Parameter Sets: file
77+
Aliases: fullname
78+
79+
Required: False
80+
Position: 0
81+
Default value: None
82+
Accept pipeline input: True (ByPropertyName, ByValue)
83+
Accept wildcard characters: False
84+
```
85+
86+
### -Path
87+
88+
This should be the value of $PSRemoteOpPath
89+
90+
```yaml
91+
Type: String
92+
Parameter Sets: folder
93+
Aliases:
94+
95+
Required: False
96+
Position: Named
97+
Default value: $PSRemoteOpPath
98+
Accept pipeline input: False
99+
Accept wildcard characters: False
100+
```
101+
102+
### -Timeout
103+
104+
Specify a timeout value in seconds between 5 and 300.
105+
106+
```yaml
107+
Type: Int32
108+
Parameter Sets: (All)
109+
Aliases:
110+
111+
Required: False
112+
Position: Named
113+
Default value: None
114+
Accept pipeline input: False
115+
Accept wildcard characters: False
116+
```
117+
118+
### CommonParameters
119+
120+
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).
121+
122+
## INPUTS
123+
124+
### System.String
125+
126+
## OUTPUTS
127+
128+
### None
129+
130+
## NOTES
131+
132+
Learn more about PowerShell:
133+
http://jdhitsolutions.com/blog/essential-powershell-resources/
134+
135+
## RELATED LINKS
136+
137+
[New-PSRemoteOperation](./New-PSRemoteOperation.md)

docs/about_PSRemoteOperations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ GitHub repository at:
173173

174174
## SEE ALSO
175175

176-
Protect-CMSMessage
176+
`Protect-CMSMessage`
177177

178178
## KEYWORDS
179179

180-
RemoteOperation
180+
`RemoteOperation`

0 commit comments

Comments
 (0)