Greeting, I have this code that will run when windows startup. The code simply will kill explorer.exe and start remote desktop connection program even a user exit the program it will be restart again.

I have no problem with code but I want to hide powershell.exe from the desktop or minimize it with disabling close button either one will work for me. I want to do that with powershell program not with remote desktop connection.

Please advice me how to do it.


Here is my code:

 $i =0
    While ($i -le 1) 
    # get a handle for the Notepad process to wait for
    $rdp = [System.Diagnostics.Process]::Start( "rdp.rdp" )
    # wait indefinitely...
    Start rdp.rdp
  • wow- I hope security isn't one of your concerns - you might at least monitor this scritp for the inevitable unauthorized modification. – Jim B Dec 23 '11 at 18:33
  • Security isn't one of my concerns – Eyla Dec 23 '11 at 22:04
  • do you have an EA license from ms if so they now have a bootable rdp client thats free. – tony roth Dec 23 '11 at 22:52
  • I have TS licenses Per device (CALs). I have 20 PCs and I want users to use them just to connect to the server. When I turn the PC I just want the user only see remote desktop connection. Note that I have windows 7 home edition so I can not connect these PCs to the domain also no Group Policy option available in windows 7 home edition – Eyla Dec 24 '11 at 6:33

I feel like I'm helping someone do something crazy here, but to hide the window, you could set this powershell script to run as a scheduled task under the SYSTEM account, or, you could do it with a program, such as in .NET:

        procStartInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
        procStartInfo.UseShellExecute = false;
        **procStartInfo.RedirectStandardOutput = true;**
        p = new Process();
        p.StartInfo = procStartInfo;
        output = "";
            output = p.StandardOutput.ReadToEnd();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.