Author Posts

May 15, 2015 at 11:56 pm

Hi,
Firstly,
Could someone help me to add ' -AsJob ' powershell feature to my functions which I wrote in the below general format.

Function Verb-Noun
{
   [CMDLetBinding()]
   Param(
      $Parameter
   )
   BEGIN{}
   PROCESS{}
   END{}
}

Secondly,
How to know any job's progress of completion and from how long time its been running?

May 16, 2015 at 4:44 am

You can't tap into the job system that easily. To have that work exactly as the native commands, you'd have to code your own job type, which ant be done in script.

May 16, 2015 at 5:48 am

Thnx for your information. Have you discussed how to write it in an any text book? or videos?
I have Powershell In Depth text book.

$CallThisText = 'Get-HealthCheck.ps1 -Server '+$Batch[$i]
							$StartInfo = New-Object System.Diagnostics.ProcessStartInfo
							$StartInfo.FileName = "C:\Windows\System32\WindowsPowerShell\V1.0\PowerShell.exe"
							$StartInfo.Arguments="-NoExit -Command `"$CallThisText`" "
							$StartInfo.LoadUserProfile = $True
							$StartInfo.UseShellExecute = $True
							$StartInfo.WorkingDirectory = (Get-Location).Path
							$proc = [System.Diagnostics.Process]::Start($StartInfo)