#PSTip Explore values that can be used with Start-Process’s -Verb parameter
Note: This tip requires PowerShell 2.0 or above.
We know that Start-Process cmdlet can be used to start a new process. This cmdlet has a parameter called –Verb that specifies what action to perform while creating the new process. The value of the parameter depends on the file type of the process being created. Let us see an example first:
PS> Start-Process notepad.exe -Verb RunAs
The above code starts notepad.exe process as administrator. But, how do we know what all verbs are supported for a given file type?
Simple! We can use System.Diagnostics.ProcessStartInfo class for that.
PS> $processInfo = New-Object System.Diagnostics.ProcessStartInfo -ArgumentList "test.exe" PS> $processInfo.Verbs open runas runasuser
As you see in the above command, we can use the New-Object cmdlet to initialize the ProcessStartInfo class constructor with a specific file type. The value of -ArgumentList parameter is just a dummy file name and it doesn’t need to exist.Share on: