Results 1 to 8 of 8

Thread: running powershell through vb.net

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    running powershell through vb.net

    Hi! I'm having quite a bit of trouble running powershell scripts through vb.net. Here's what I have so far:

    Code:
      Dim psi As New ProcessStartInfo() ' initialize processstartinfo (psi)
            psi.Verb = "runas" ' runas = run as administrator
            psi.FileName = ("powershell.exe")
            psi.Arguments = "/c ""C:\mountiso.ps1"""
    I've worked out the whole security issue that is inherent with windows 10 so that's not the issue.

    I'm hoping the solution is easier than the problem.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,392

    Re: running powershell through vb.net


  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    Re: running powershell through vb.net

    would you believe but I already came across that but to be honest it's a bit above my head, i was hoping for something a little more newbie friendly.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    Re: running powershell through vb.net

    When I copy and paste your solution i get the following error:
    Attachment 179002
    Can you help me out?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    Re: running powershell through vb.net

    Never mind i figured it out! I'm still getting error messages but I'll figure them out!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    Re: running powershell through vb.net

    OK now I'm getting a security issue:
    Code:
    Errors:
    -------
    C:\mountiso.ps1 : File C:\mountiso.ps1 cannot be loaded because running scripts is disabled on this system. For more 
    information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
    At line:1 char:1

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    72

    Re: running powershell through vb.net

    I know this command sorts this error:
    Code:
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted
    but how do i issue the command?

  8. #8
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,392

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width