Skip to content

Commit

Permalink
v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jul 31, 2019
1 parent 5ea2bb5 commit 33b2c13
Show file tree
Hide file tree
Showing 16 changed files with 549 additions and 112 deletions.
7 changes: 4 additions & 3 deletions PSRemoteOperations.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RootModule = ""

# Version number of this module.
ModuleVersion = '3.0.0'
ModuleVersion = '3.1.0'

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

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

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

# 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.
FunctionsToExport = @('New-PSRemoteOperation','Invoke-PSRemoteOperation','Get-PSRemoteOperationResult','Register-PSRemoteOperationWatcher')
FunctionsToExport = @('New-PSRemoteOperation', 'Invoke-PSRemoteOperation', 'Get-PSRemoteOperationResult', 'Register-PSRemoteOperationWatcher',
'Wait-PSRemoteOperation')

# 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.
CmdletsToExport = ''
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PSRemoteOperations

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.
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.

You can install the latest version from the PowerShell Gallery:

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

## Cross-Platform and PowerShell Core

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

*last updated 22 October 2018*
Last updated 2019-07-31 17:39:11Z UTC
10 changes: 5 additions & 5 deletions autocompleters.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
Register-ArgumentCompleter -CommandName Get-PSRemoteOperationResult, New-PSRemoteOperation -ParameterName Computername -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

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

if ($wordToComplete) {
$fill = $names | where-object {$_ -match "$wordToComplete" }
$fill = $names | Where-Object { $_ -match "$wordToComplete" }
}
else {
$fill = $names
}
$fill | ForEach-Object {
$fill | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}

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

(get-childitem -Path Cert:\CurrentUser\my -DocumentEncryptionCert).Subject |
ForEach-Object {
(Get-ChildItem -Path Cert:\CurrentUser\my -DocumentEncryptionCert).Subject |
ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log for PSRemoteOperations

## v3.1.0

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

## v3.0.0

+ restructured module to support Core and Windows through nested modules. (Issue #9)
Expand Down
6 changes: 3 additions & 3 deletions docs/Get-PSRemoteOperationResult.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRemoteOperations-help.xml
Module Name: PSRemoteOperations
online version:
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Get-PSRemoteOperationResult.md
schema: 2.0.0
---

Expand Down Expand Up @@ -65,7 +65,7 @@ Enter a computername to filter on.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: cn

Required: False
Position: Named
Expand Down Expand Up @@ -112,4 +112,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[Invoke-PSRemoteOperation](./Invoke-PSRemoteOperation)
[New-PSRemoteOperation](./New-PSRemoteOperation)
[New-PSRemoteOperation](./New-PSRemoteOperation)
6 changes: 3 additions & 3 deletions docs/Invoke-PSRemoteOperation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRemoteOperations-help.xml
Module Name: PSRemoteOperations
online version:
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Invoke-PSRemoteOperation.md
schema: 2.0.0
---

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

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

Expand Down Expand Up @@ -122,4 +122,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[New-PSRemoteOperation](./New-PSRemoteOperation)
[Get-PSRemoteOperationResult](./Get-PSRemoteOperationResult])
[Get-PSRemoteOperationResult](./Get-PSRemoteOperationResult])
6 changes: 3 additions & 3 deletions docs/New-PSRemoteOperation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRemoteOperations-help.xml
Module Name: PSRemoteOperations
online version:
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/New-PSRemoteOperation.md
schema: 2.0.0
---

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

Required: True
Position: 0
Expand Down Expand Up @@ -279,4 +279,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[Register-PSRemoteOperationWatcher](./Register-PSRemoteOperationWatcher)
[Protect-CmsMessage](http://go.microsoft.com/fwlink/?LinkId=821716)
[Protect-CmsMessage](http://go.microsoft.com/fwlink/?LinkId=821716)
6 changes: 3 additions & 3 deletions docs/Register-PSRemoteOperationWatcher.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSRemoteOperations-help.xml
Module Name: PSRemoteOperations
online version:
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Register-PSRemoteOperationWatcher.md
schema: 2.0.0
---

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

Use the PowerShell scheduledjob cmdlets to remove the watcher job.
Use the PowerShell scheduled job cmdlets to remove the watcher job.

## PARAMETERS

Expand Down Expand Up @@ -203,4 +203,4 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[New-PSRemoteOperation](./New-PSRemoteOperation)
[Register-ScheduledJob](http://go.microsoft.com/fwlink/?LinkId=821702)
[Register-ScheduledJob](http://go.microsoft.com/fwlink/?LinkId=821702)
137 changes: 137 additions & 0 deletions docs/Wait-PSRemoteOperation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
external help file: PSRemoteOperations-help.xml
Module Name: PSRemoteOperations
online version: https://github.com/jdhitsolutions/PSRemoteOperations/blob/master/docs/Wait-PSRemoteOperation.md
schema: 2.0.0
---

# Wait-PSRemoteOperation

## SYNOPSIS

Wait for a PSRemoteOperation to complete.

## SYNTAX

### folder (Default)

```yaml
Wait-PSRemoteOperation [-Path <String>] [-Computername <String>] [-Timeout <Int32>] [<CommonParameters>]
```

### file

```yaml
Wait-PSRemoteOperation [[-FilePath] <String>] [-Timeout <Int32>] [<CommonParameters>]
```

## DESCRIPTION

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.

This command does not write any results to the pipeline.

## EXAMPLES

### Example 1

```powershell
PS C:\> New-PSRemoteOperation -scriptblock { get-process | export-clixml c:\shared\proc.xml} -computername SRV1 -passthru | Wait-PSRemoteOperation
```

This example will create a new PSRemote operation which passes the resulting .psd1 file to Wait-PSRemoteOperation.

### Example 2

```powershell
PS C:\> Wait-PSRemoteOperation -computername SRV2 -timeout 30
```

Watch the $PSRemoteOpPath folder for a job targeted to SRV2 but timeout waiting after 30 seconds.

## PARAMETERS

### -Computername

Wait for results from a specific computer

```yaml
Type: String
Parameter Sets: folder
Aliases: cn

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -FilePath
Specify the path to a PSRemoteOperation file.
```yaml
Type: String
Parameter Sets: file
Aliases: fullname

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -Path
This should be the value of $PSRemoteOpPath
```yaml
Type: String
Parameter Sets: folder
Aliases:

Required: False
Position: Named
Default value: $PSRemoteOpPath
Accept pipeline input: False
Accept wildcard characters: False
```
### -Timeout
Specify a timeout value in seconds between 5 and 300.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
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).
## INPUTS
### System.String
## OUTPUTS
### None
## NOTES
Learn more about PowerShell:
http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
[New-PSRemoteOperation](./New-PSRemoteOperation.md)
4 changes: 2 additions & 2 deletions docs/about_PSRemoteOperations.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ GitHub repository at:

## SEE ALSO

Protect-CMSMessage
`Protect-CMSMessage`

## KEYWORDS

RemoteOperation
`RemoteOperation`
Loading

0 comments on commit 33b2c13

Please sign in to comment.