Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gp on terminal server but not local machine

Status
Not open for further replies.

sk8ology

IS-IT--Management
Joined
May 14, 2004
Messages
64
Location
US
I want to setup up Group Policy’s that are enabled when a user logs on to my terminal server but not when they log into their local machine. How I have things setup is, when a user logs on to their local machine there is an rdp icon directing them to the TS. I have VLANS setup blocking them from everything but that TS. I want to setup their TS desktop with certain lockdowns according to active directory (Sales, Marketing, Collection, ETC.). I did some tests and the Icon that is mapped to the local desktop disappears on the local desktop with the GP settings. Is there a way to have the rdp icon show up on the local machine but not on the terminal server? Or only have the gp work on the terminal server but not on the local machine?
 
I would do this with a vbscript. Have the script detect if the machine is the server and exit, otherwise create the icon. Fairly simple to do. Let me know if you need assistance writing the code.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
I was thinking something along those lines. I was thinking there had to be a script to create the rdp icon on the local machine but not the terminal server.

So your saying the script would end if the machine is a server and continue if not?

I will look into this, but if you could help that would be awesome.
 
Simple enough, here you go.

Code:
'==========================================================================
'
' NAME: CreateRDP4NonServers.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.TheSpidersParlor.com[/URL]
' COPYRIGHT (c) 2006 All Rights Reserved
' DATE  : 6/8/2006
'
'    This code is Copyright (c) 2006 Microsoft Corporation.
'
'    All rights reserved.
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS 
'    LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
' COMMENT: 
'
'==========================================================================

On Error Resume Next
strComputer = "."
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
	If InStr(1,objItem.Caption,"Server") Then 
		WScript.Quit
    Else
        'Create RDP Icon on Desktop
		WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
		strDsk = WshShell.SpecialFolders("Desktop")
		strshortcut = strDsk & "\RDP Client.lnk"
		If Not fso.FileExists(strshortcut) Then
			SET oUrlLink = WshShell.CreateShortcut(strshortcut)
			oUrlLink.TargetPath = Windir & "\System32\mstsc.EXE"
			oUrlLink.Save
		End If
	End If
Next

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
This worked perfectly. I modified it a little to run an rdp file that automatically connects to the server with specific settings. And put this file out on the network. I’m almost there. I just got to get ready to be hated. I'm sure I will be rewarded by my superiors but not asked out to lunch anymore by those this lockdown gets rolled out to.

Thanks for this script. I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top