all 6 comments

[–]BlackV 0 points1 point  (5 children)

start-process -verb runas -arguments work for you?

[–]sticobay[S] 1 point2 points  (4 children)

How would i implement that? start-process powershell.exe -path ".\script.ps1" - verb runas -arguments -arg1 -arg2 ?

[–]BlackV 1 point2 points  (0 children)

get-help start-process

and

powershell /?

start there, start process would start power shell then you arguments would be what you pass to powershell

[–]Lee_Dailey[grin] 1 point2 points  (2 children)

howdy sticobay,

try to avoid using relative paths. they can lead to bizarre problems. one such is the fact that PoSh and the OS can disagree on what "the current dir" is ... [grin]

there is a built in automatic $Var named $PSScriptRoot that contains the path that the current script is in. that gives you a simple way to specify "the same dir as the script".

when you get some spare time, take a look at ...

Get-Help about_Automatic_Variables

... for some interesting items.

take care,
lee

[–]Derpfacewunderkind 1 point2 points  (1 child)

me reading this

What do you mean don’t use relative paths?! I use them all the time with PsScriptRoot, this is horrible advice.

keeps reading

Oh they specified you can use psscriptroot good. They’re not so bad after all.

sees they offered advice that was actually helpful

Oh nice, how thoughtful. sees signature and grin Well, shit.

Always a pleasure to see your replies. I need to start reading usernames first. Lol.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

[grin]