Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Start-JobSchedulerExecutableFile

SYNOPSIS

Starts an the specified executable file in a Windows OS with parameters optionally for a different user account.

...

Runs the specified executable file in the context of a different user account for a Windows OS.
The cmdlet reads credentials from the Windows Credential Manager, i.e. credentials
that have previously been added by the Windows command "cmdkey" or any other credential management tools.
Credentials are indicated by their "target name" name which represents the identifier by which
credentials are retrieved.

By default a user profile is considered. The -NoLoadUserProfile parameter prevents using a profile.

The cmdlet returns a [System.Diagnostics.Process] object that includes additional properties:

* By default
** output to stdout is available with the "StandardOutputContent" property.
** output to stderr is available with the "StandardErrorContent" property.

* With the parameters -NoStandardOutput and -NoStandardError respectively being used
** output to stdout is available from a temporary file that is indicated with the "StandardOutputFile" property.
** output to stderr is available from a temporary file that is indicated with the "StandardErrorFile" property.
* An exit code is not reliably reported if the cmdlet is used from an unprivileged account to start a process for a different user

PARAMETERS

Path

-Path <String>
Specifies the full path and name of the executable file to be started. Executable files includes binary files (.com, .exe)
and command scripts (.cmd, .bat) etc..

Required?true
Position?1
Default value
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

Required?false
Position?2
Default value
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

Required?false
Position?3
Default value
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)false
Accept wildcard characters?false

...

PS > $process = Start-JobSchedulerExecutableFile -Path 'c:/tmp/powershell/sample_script.cmd' -TargetName 'run_as_aplocalhost'

Runs the command script for the account that is specified with the credentials identified by the target name. The resulting process object includes the properties * $process.StandardOutputContent * $process.StandardErrorContent that contain the output that is created to stdout and stderr.

...

PS > $process = Start-JobSchedulerExecutableFile -Path 'c:/tmp/powershell/sample_script.cmd' -TargetName 'run_as_aplocalhost' -NoStandardOutput -NoStandardError

...