Skip to content

Commit 7a7e252

Browse files
v3.3.0
1 parent 5b12f57 commit 7a7e252

12 files changed

+759
-65
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
"nrof",
1515
"operations",
1616
"ps",
17+
"psremoteoperations",
1718
"recipient",
1819
"remote",
1920
"scriptpath"
2021
],
2122
"cSpell.ignoreWords": [
23+
"dropbox",
2224
"runspace"
2325
]
2426
}

PSRemoteOperations.psd1

Lines changed: 18 additions & 16 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.2.1'
11+
ModuleVersion = '3.3.0'
1212

1313
# Supported PSEditions
1414
CompatiblePSEditions = @("Desktop","Core")
@@ -72,12 +72,13 @@ else {
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.
7373
FunctionsToExport = if ($PSEdition -eq 'Core') {
7474
'New-PSRemoteOperation', 'Invoke-PSRemoteOperation', 'Get-PSRemoteOperationResult', 'Wait-PSRemoteOperation',
75-
'Get-PSRemoteOperation'
75+
'Get-PSRemoteOperation','Register-PSRemoteOpPath','Import-PSRemoteOpPath'
7676
}
7777
else {
7878
#Windows PowerShell gets everything
7979
'New-PSRemoteOperation', 'Invoke-PSRemoteOperation', 'Get-PSRemoteOperationResult', 'Register-PSRemoteOperationWatcher',
80-
'Wait-PSRemoteOperation', 'New-PSRemoteOperationForm', 'Get-PSRemoteOperation'
80+
'Wait-PSRemoteOperation', 'New-PSRemoteOperationForm', 'Get-PSRemoteOperation','Register-PSRemoteOpPath',
81+
'Import-PSRemoteOpPath'
8182
}
8283

8384
# 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.
@@ -106,25 +107,26 @@ else {
106107
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
107108
PrivateData = @{
108109

109-
PSData = @{
110+
PSData = @{
110111

111-
# Tags applied to this module. These help with module discovery in online galleries.
112-
Tags = @("Remoting","ScheduledJob")
112+
# Tags applied to this module. These help with module discovery in online galleries.
113+
Tags = @("Remoting", "ScheduledJob")
113114

114-
# A URL to the license for this module.
115-
LicenseUri = 'https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/license.txt'
115+
# A URL to the license for this module.
116+
LicenseUri = 'https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/license.txt'
116117

117-
# A URL to the main website for this project.
118-
ProjectUri = 'https://github.com/jdhitsolutions/PSRemoteOperations'
118+
# A URL to the main website for this project.
119+
ProjectUri = 'https://github.com/jdhitsolutions/PSRemoteOperations'
119120

120-
# A URL to an icon representing this module.
121-
# IconUri = ''
121+
# A URL to an icon representing this module.
122+
# IconUri = ''
122123

123-
# ReleaseNotes of this module
124-
# ReleaseNotes = ''
125-
# ExternalModuleDependencies = "PSScheduledJob"
124+
# ReleaseNotes of this module
125+
ReleaseNotes = 'http://bit.ly/2KsYbu2'
126126

127-
} # End of PSData hashtable
127+
# ExternalModuleDependencies = "PSScheduledJob"
128+
129+
} # End of PSData hashtable
128130

129131
} # End of PrivateData hashtable
130132

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# PSRemoteOperations
22

3+
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSRemoteOperations.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSRemoteOperations/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSRemoteOperations.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSRemoteOperations/)
4+
5+
36
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.
47

58
You can install the latest version from the PowerShell Gallery:
@@ -19,6 +22,8 @@ Or check out the individual commands:
1922
+ [Register-PSRemoteOperationWatcher](docs/Register-PSRemoteOperationWatcher.md)
2023
+ [Wait-PSRemoteOperation](docs/Wait-PSRemoteOperation.md)
2124
+ [New-PSRemoteOperationForm](docs/New-PSRemoteOperationForm.md)
25+
+ [Register-PSRemoteOpPath](docs/Register-PSRemoteOpPath.md)
26+
+ [Import-PSRemoteOpPath](docs/Import-PSRemoteOpPath.md)
2227

2328
## Graphical Interface
2429

@@ -36,4 +41,4 @@ This should work fine for simple script blocks. For anything more complicated, i
3641

3742
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`.
3843

39-
Last updated 2019-08-10 17:03:11Z UTC
44+
Last updated 2019-08-20 13:13:32Z UTC

autocompleters.ps1

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Register-ArgumentCompleter -CommandName Get-PSRemoteOperationResult, New-PSRemot
1515
}
1616
}
1717

18-
Register-ArgumentCompleter -CommandName Wait-PSRemoteOperation,Get-PSRemoteOperation -ParameterName Computername -ScriptBlock {
18+
Register-ArgumentCompleter -CommandName Wait-PSRemoteOperation, Get-PSRemoteOperation -ParameterName Computername -ScriptBlock {
1919
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
2020

2121
$names = (Get-ChildItem -Path $PSRemoteOpPath -file | Split-Path -leaf).foreach( {$_.split("_")[0].toUpper() }) | Get-Unique
@@ -35,7 +35,30 @@ Register-ArgumentCompleter -CommandName New-PSRemoteOperation -ParameterName To
3535
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
3636

3737
(Get-ChildItem -Path Cert:\CurrentUser\my -DocumentEncryptionCert).Subject |
38-
ForEach-Object {
38+
ForEach-Object {
3939
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
4040
}
41+
}
42+
43+
<#
44+
Test for the json file with remote op path settings and prompt the user to run Register-PSRemoteOpPath if not found
45+
#>
46+
47+
$json = Join-Path -path $PSScriptRoot -ChildPath psremoteoppath.json
48+
49+
if (Test-Path $json) {
50+
Import-PSRemoteOpPath -path $json
51+
}
52+
else {
53+
$msg = @"
54+
No PSRemoteOpPath settings file was found to import. The module will be easier to use
55+
if you set global variables for `$PSRemoteOpPath and `$PSRemoteOpArchive. Run the
56+
commmand Register-PSRemoteOpPath. If you've recently updated the module through the
57+
PowerShell Gallery, you'll need to re-register the paths.
58+
59+
If you prefer to set the values in your profile script you can ignore this
60+
warning.
61+
"
62+
"@
63+
Write-Warning $msg
4164
}

changelog.md

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

3+
## v3.3.0
4+
5+
+ Added commands `Register-PSRemoteOpPath` and `Import-PSRemoteOpPath` to store path variables with the module. (Issue #13)
6+
+ Added better error handling to `Get-PSRemoteOperation` and `Get-PSRemoteOperationResult` when unprotecting a CMS message. (Issue #14)
7+
+ Updated about help
8+
+ Updated `README.md`
9+
+ Updated Pester tests
10+
311
## v3.2.1
412

513
+ Replaced online help links to markdown documents with bitly links

docs/Import-PSRemoteOpPath.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
external help file: PSRemoteOperations-help.xml
3+
Module Name: PSRemoteOperations
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Import-PSRemoteOpPath
9+
10+
## SYNOPSIS
11+
12+
Import path settings for the PSRemoteOperations module
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Import-PSRemoteOpPath [[-Path] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This command will import the PSRemoteOPPath.json file in the module directory, and define the $PSRemoteOpPath and $PSRemoteOpArchive global variables. This settings file should be created with Register-PSRemoteOpPath. Normally, you should not need to run this command as settings are imported and defined when the module is imported.
23+
24+
## EXAMPLES
25+
26+
### Example 1
27+
28+
```powershell
29+
PS C:\> Register-PSRemoteOpPath
30+
```
31+
32+
Manually import the settings.
33+
34+
## PARAMETERS
35+
36+
### -Confirm
37+
38+
Prompts you for confirmation before running the cmdlet.
39+
40+
```yaml
41+
Type: SwitchParameter
42+
Parameter Sets: (All)
43+
Aliases: cf
44+
45+
Required: False
46+
Position: Named
47+
Default value: None
48+
Accept pipeline input: False
49+
Accept wildcard characters: False
50+
```
51+
52+
### -Path
53+
54+
Enter the path to the remote op path json file. You should normally use the default but you can specify an alternate path for testing purposes.
55+
56+
```yaml
57+
Type: String
58+
Parameter Sets: (All)
59+
Aliases:
60+
61+
Required: False
62+
Position: 0
63+
Default value: $PSScriptRoot\psremoteoppath.json
64+
Accept pipeline input: False
65+
Accept wildcard characters: False
66+
```
67+
68+
### -WhatIf
69+
70+
Shows what would happen if the cmdlet runs.
71+
The cmdlet is not run.
72+
73+
```yaml
74+
Type: SwitchParameter
75+
Parameter Sets: (All)
76+
Aliases: wi
77+
78+
Required: False
79+
Position: Named
80+
Default value: None
81+
Accept pipeline input: False
82+
Accept wildcard characters: False
83+
```
84+
85+
### CommonParameters
86+
87+
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).
88+
89+
## INPUTS
90+
91+
### None
92+
93+
## OUTPUTS
94+
95+
### System.Object
96+
97+
## NOTES
98+
99+
Learn more about PowerShell:
100+
http://jdhitsolutions.com/blog/essential-powershell-resources/
101+
102+
## RELATED LINKS
103+
104+
[Register-PSRemoteOpPath](./Register-PSRemoteOpPath.md)

docs/Register-PSRemoteOpPath.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
external help file: PSRemoteOperations-help.xml
3+
Module Name: PSRemoteOperations
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Register-PSRemoteOpPath
9+
10+
## SYNOPSIS
11+
12+
Register remote operations path
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Register-PSRemoteOpPath [-PSRemoteOpPath] <String> [-PSRemoteOpArchive] <String> [-WhatIf] [-Confirm]
18+
[<CommonParameters>]
19+
```
20+
21+
## DESCRIPTION
22+
23+
Many of the commands in this module rely on global variables to know where to store the pending remote operations file, $PSRemoteOpPath, and the archive folder, $PSRemoteOpArchive. Module commands that have a Path parameter default to these variables. In earlier versions of this module you could define these variables in PowerShell profile to avoid constantly having to enter them.
24+
25+
This command will store your settings in a json file located in the module directory. When importing the module, the settings will also be imported and the global variables defined. If you don't have the settings file, you will see a warning message upon import.
26+
27+
It is assumed the locations are shared or synchronized by some method or external application like Dropbox or OneDrive.
28+
29+
## EXAMPLES
30+
31+
### Example 1
32+
33+
```powershell
34+
35+
PS C:\> Register-PSRemoteOpPath -PSRemoteOpPath $env:userprofile\dropbox\psremoteop -PSRemoteOpArchive $env:userprofile\dropbox\psremoteop\archive
36+
```
37+
38+
Register the locations. Be aware that the paths will be converted to complete filesystem paths. Registration will also import the values.
39+
40+
## PARAMETERS
41+
42+
### -Confirm
43+
44+
Prompts you for confirmation before running the cmdlet.
45+
46+
```yaml
47+
Type: SwitchParameter
48+
Parameter Sets: (All)
49+
Aliases: cf
50+
51+
Required: False
52+
Position: Named
53+
Default value: None
54+
Accept pipeline input: False
55+
Accept wildcard characters: False
56+
```
57+
58+
### -PSRemoteOpArchive
59+
60+
Enter a filesystem path for the Remote Operations Archive path. It must already exist. This will be used to define $PSRemoteOpArchive.
61+
62+
```yaml
63+
Type: String
64+
Parameter Sets: (All)
65+
Aliases:
66+
67+
Required: True
68+
Position: 1
69+
Default value: None
70+
Accept pipeline input: False
71+
Accept wildcard characters: False
72+
```
73+
74+
### -PSRemoteOpPath
75+
76+
Enter a filesystem path for the Remote Operations path. It must already exist and should be shared folder that is managed by some other process or application such as Dropbox or OneDrive. This will be used to define $PSRemoteOpPath.
77+
78+
```yaml
79+
Type: String
80+
Parameter Sets: (All)
81+
Aliases:
82+
83+
Required: True
84+
Position: 0
85+
Default value: None
86+
Accept pipeline input: False
87+
Accept wildcard characters: False
88+
```
89+
90+
### -WhatIf
91+
92+
Shows what would happen if the cmdlet runs.
93+
The cmdlet is not run.
94+
95+
```yaml
96+
Type: SwitchParameter
97+
Parameter Sets: (All)
98+
Aliases: wi
99+
100+
Required: False
101+
Position: Named
102+
Default value: None
103+
Accept pipeline input: False
104+
Accept wildcard characters: False
105+
```
106+
107+
### CommonParameters
108+
109+
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).
110+
111+
## INPUTS
112+
113+
### None
114+
115+
## OUTPUTS
116+
117+
### None
118+
119+
## NOTES
120+
121+
Learn more about PowerShell:
122+
http://jdhitsolutions.com/blog/essential-powershell-resources/
123+
124+
## RELATED LINKS
125+
126+
[Import-PSRemoteOpPath](./Import-PSRemoteOpPath.md)
127+

0 commit comments

Comments
 (0)