Script CancelAllQueries.ps1 has hardcoded script path inside

Mar 25, 2008 at 6:14 PM
In new PowerShell Script sample query CancelAllQueries has script path hardcoded to c:\scripts:
c:\scripts\Invoke-DMV.ps1
c:\scripts\invoke-cancelsession.ps1

I believe this should be replaced with:
.\Invoke-DMV.ps1
.\invoke-cancelsession.ps1


Vidas
Coordinator
Mar 26, 2008 at 3:41 PM
Yes, if you execute the powershell script from within the c:\scripts folder. However, if you execute the powershell script from another location using an absolute path to refer to the script you wish to execute, the relative pathing will fail - unless you use the Set-Location command in the script. For example, Set-Location C:\Scripts - add this to the beginning of the CancelAllQueries.ps1 script - you can then use relative pathing.
HTH
Carl