Announcement

Collapse
No announcement yet.

Need help with GP login script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with GP login script

    All, first time on the forum - hello to everyone. I have an issue where I've written wscripts that create desktop icons for the users on AD login. One, specifically creates a RDP desktop object to a terminal server based on group membership. So far - so good... My problem today is that when the user then RDPs to the terminal server from his/her desktop and logs-in, the AD login script of course runs again and the RDP object is again created but this time on the user's TS desktop. Some of my users are not the sharpests tacks in the box and have clicked on the "second" RDP and opened another (and another) session within the first session... I need a way to have the RDP object created only on login to the user's machine and not on the subsequent login to TS. I have the TS in it's own OU with loopback enabled in "merge" mode and all users that login to it via RDP also belong to a group in the OU for customizing the user's TS experience separate from their normal AD experience.

    Any help would be most welcomed.

    Thanks in advance

  • #2
    Re: Need help with GP login script

    Try if this works for you,

    Code:
    Const CONSOLE = "CONSOLE"
    
    'cut -----8<---------------------------
    
    Set oShell = CreateObject( "WScript.Shell" )
    strSession = _
      UCase(oShell.ExpandEnvironmentStrings("%SESSIONNAME%"))
    If strSession = CONSOLE Then 
      ' create desktop icons
    End If
    
    'cut -----8<---------------------------
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: Need help with GP login script

      Rems - thanks for the reply. I've gotten further. Here's my VBScript, although I don't get any errors (compile or syntax) it does NOT have the desired effect of creating the RDP desktop shortcut... It doesn't do much of anything. I'm sure I've forgotten something...

      set wshShell = WScript.CreateObject("WScript.Shell")
      Const CONSOLE = "CONSOLE"
      strSession = _
      UCase(wshShell.ExpandEnvironmentStrings("%SESSIONN AME%"))
      If strSession = CONSOLE Then
      Function SetCommonITShortcuts()
      Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\Remote Desktop.lnk")
      objShortcutLnk.TargetPath = "%windir%\system32\mstsc.exe"
      objShortcutLnk.Save
      End Function
      End If

      Comment


      • #4
        Re: Need help with GP login script

        Rems,
        Figured it out... Here's the VBScript

        set wshShell = WScript.CreateObject("WScript.Shell")
        Const CONSOLE = "CONSOLE"
        strSession = _
        UCase(wshShell.ExpandEnvironmentStrings("%SESSIONN AME%"))
        If strSession = CONSOLE Then
        strDesktop = WshShell.SpecialFolders("Desktop")
        Set objShortcutLnk = WshShell.CreateShortcut(strDesktop & "\RemoteDesktop.lnk")
        objShortcutLnk.TargetPath = "%windir%\system32\mstsc.exe"
        objShortcutLnk.Save
        End If

        This now works fine, the user gets the RDP shortcut on their PC desktop, but it does not appear on their TS desktop. Could not of done it without your expert direction - Thank you so, so much!!!
        Robert

        Comment

        Working...
        X