Setting Terminal Services settings using ASP.NET (or... calling Server-side vbscript from ASP.NET)

Discussion in 'ASP .Net' started by Roja Doja, Apr 13, 2005.

  1. Roja Doja

    Roja Doja Guest

    I need to be able to change the Terminal Services attributes.

    Using vbscript on Server 2003 this is easy enough, as described at

    http://www.microsoft.com/technet/scriptcenter/scripts/ts/default.mspx

    for example.

    I want to be able to write a web interface to do this, to make it
    easier for those who will be setting these settings, and to log
    changes, control access etc. However, doing the same simple task in
    ..Net languages (C# VB.NET etc) is proving damn near impossible. After
    wrapping a Win32 API, I find I can now alter string type settings in
    C#, such as TerminalServicesProfilePath, but not DWORD settings such
    as MaxDisconnectionTime, which is the one I really want to be able to
    change via a web interface.

    As it's easy enough in vbscript, I'm wondering if there is any way I
    can call a server-side vbscript plus parameters from within an ASP.NET
    page?

    Thanks,
    Roger
    Roja Doja, Apr 13, 2005
    #1
    1. Advertising

  2. Roja Doja

    Scott Allen Guest

    Some of the interop stuff can get really messy. You could use the
    System.Diagnostics.Process class to spin off a vbs script.

    --
    Scott


    On 13 Apr 2005 10:02:27 -0700, (Roja Doja)
    wrote:

    >I need to be able to change the Terminal Services attributes.
    >
    >Using vbscript on Server 2003 this is easy enough, as described at
    >
    >http://www.microsoft.com/technet/scriptcenter/scripts/ts/default.mspx
    >
    >for example.
    >
    >I want to be able to write a web interface to do this, to make it
    >easier for those who will be setting these settings, and to log
    >changes, control access etc. However, doing the same simple task in
    >.Net languages (C# VB.NET etc) is proving damn near impossible. After
    >wrapping a Win32 API, I find I can now alter string type settings in
    >C#, such as TerminalServicesProfilePath, but not DWORD settings such
    >as MaxDisconnectionTime, which is the one I really want to be able to
    >change via a web interface.
    >
    >As it's easy enough in vbscript, I'm wondering if there is any way I
    >can call a server-side vbscript plus parameters from within an ASP.NET
    >page?
    >
    >Thanks,
    >Roger
    Scott Allen, Apr 14, 2005
    #2
    1. Advertising

  3. Roja Doja

    Roja Doja Guest

    Of course, yes, thanks v.much. I'd even used
    System.Diagnostics.Process before in an application, somehow I always
    think of webserver code as different...

    Anyway, just in case it's helpful, here's my working code (I don't
    clainm anything, other than it works for me...) I could only get it
    to work by calling cscript first, and I could only call cscript if I
    set the working directory to C:\Windows\System32\ to find cscript,
    rather than use the directory of the script.

    Process myProcess = new Process();
    myProcess.StartInfo.WorkingDirectory = @"C:\Windows\System32\";
    myProcess.StartInfo.FileName=@"cscript";
    myProcess.StartInfo.UseShellExecute=false;
    myProcess.StartInfo.RedirectStandardOutput = true;
    myProcess.StartInfo.Arguments=@"/b
    W:\Virtual\webdir\bin\myscript.vbs";
    myProcess.Start();
    string result = myProcess.StandardOutput.ReadToEnd();

    Cheers,
    Roger
    Roja Doja, Apr 14, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eitan
    Replies:
    2
    Views:
    520
    Eitan
    Jun 4, 2005
  2. alan
    Replies:
    2
    Views:
    6,406
  3. COHENMARVIN
    Replies:
    2
    Views:
    874
    Jason Kester
    Oct 20, 2005
  4. donet programmer
    Replies:
    3
    Views:
    1,535
    Gregory A. Beamer
    Nov 20, 2009
  5. David Shorthouse

    server-side vbscript call with javascript client-side

    David Shorthouse, Feb 2, 2005, in forum: ASP General
    Replies:
    2
    Views:
    352
    Mark Schupp
    Feb 3, 2005
Loading...

Share This Page