Results 1 to 4 of 4

Thread: VB script to run mstsc and to fill in the servername

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    5

    VB script to run mstsc and to fill in the servername

    Hi guys,

    I need some help. I need to write a Vbscript that starts MSTSC and fill in the box "SERVER1" and after press OK

    I made the following code:

    Dim WSHShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Return = WshShell.RUN ("mstsc")
    WScript.Quit


    But this script starts only MSTSC. So now i am looking for a code to write SERVER1 in the box.

    Thanks a lot
    Last edited by Mozes; Mar 12th, 2012 at 09:52 AM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    5

    Re: VB script to run mstsc and to fill in the servername

    I wrote this code:

    Return = WshShell.Run ("c:\Users\mozes\Desktop\server1.rdp")

    But i am getting an error...

  3. #3
    Addicted Member
    Join Date
    Jul 2009
    Posts
    208

    Re: VB script to run mstsc and to fill in the servername

    Maybe:
    Code:
    Dim WSH
    Set WSH = CreateObject("WScript.Shell")
    WSH.Run "MSTSC /v:SERVER1"
    or try changing the Run statement to:
    Code:
    WSH.Run "CMD /c MSTSC /v:SERVER1"
    See http://ss64.com/nt/mstsc.html for more options.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    5

    Re: VB script to run mstsc and to fill in the servername

    Quote Originally Posted by His Nibbs View Post
    Maybe:
    Code:
    Dim WSH
    Set WSH = CreateObject("WScript.Shell")
    WSH.Run "MSTSC /v:SERVER1"
    or try changing the Run statement to:
    Code:
    WSH.Run "CMD /c MSTSC /v:SERVER1"
    See http://ss64.com/nt/mstsc.html for more options.
    thnaks a lot..it worked!

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