manage to make a solution myself.
Dim combined As String = Path.Combine(My.Application.Info.DirectoryPath, Path.GetFileName("\Script.ps1"))
Dim powerShellPath = "C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe"
Process.Start(powerShellPath, "-noexit -file " & "" & combined & "" & " -Verb RunAs""")
or better solutions to others :)
Dim combined As String = Path.Combine(My.Application.Info.DirectoryPath, Path.GetFileName("\Script.ps1"))
If Environment.Is64BitOperatingSystem = True Then
Dim powerShellPath = "%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe"
Process.Start(powerShellPath, "-noexit -file " & "" & combined & "" & " -Verb RunAs""")
Else
Dim powerShellPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe"
Process.Start(powerShellPath, "-noexit -file " & "" & combined & "" & " -Verb RunAs""")
End If
Only 1 remark as i test all stuff i found out that using %SystemRoot% will not work out.
you need to use full path C:\Windows\ then it works.