File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ function Stop-OpenXML {
2+ <#
3+ . SYNOPSIS
4+ Stops an OpenXML Server
5+ . DESCRIPTION
6+ Stops a server running from an OpenXML.
7+ . NOTES
8+ This will stop any jobs with HTTP listeners and OpenXML
9+ #>
10+ param (
11+ # The input object.
12+ # Any input without an HttpListener and OpenXML property will be ignored.
13+ [Parameter (ValueFromPipeline )]
14+ [PSObject ]
15+ $InputObject ,
16+
17+ # If set, will pass thru the input.
18+ [switch ]
19+ $PassThru
20+ )
21+
22+ process {
23+ # If the input is lacking a listener or OpenXML, return
24+ if (-not $InputObject.HttpListener -or -not $InputObject.OpenXML ) {
25+ # (pass thru the input if we asked)
26+ if ($PassThru ) {
27+ return $InputObject
28+ }
29+ return
30+ }
31+
32+ # Stop the listener
33+ $InputObject.HttpListener.Stop ()
34+ # and attempt to stop the job (ideally so that it reports as stopped, not completed)
35+ if ($InputObject.StopJob -is [Management.Automation.PSMethod ]) {
36+ $InputObject.StopJob ()
37+ }
38+ if ($PassThru ) {
39+ return $InputObject
40+ }
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments