Announcement

Collapse
No announcement yet.

Script acts different for TS sessions

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

  • Script acts different for TS sessions

    Ok,

    Strange one this. We run this vBscript from our login script (kixtart) and it works fine for everyone using Domain PC's

    It also works fine for everyone if logging into a TS session apart from the following issue.

    When I login to TS session something is causing the Outlook Profile screen to launch (I'm a domain admin) and it also happens for others in ICT

    Code:
    On Error Resume Next
    Set objSysInfo = CreateObject("ADSystemInfo")
    Set WshShell = CreateObject("WScript.Shell")
    strUser = objSysInfo.UserName
    Set objSysInfo = CreateObject("ADSystemInfo") 
    Set objUser = GetObject("LDAP://" & strUser)
    Set objGroup1 = GetObject("ldap://cn=All RCDAs,ou=User Accounts,dc=mydomain,dc=local")
    Set objGroup2 = GetObject("ldap://cn=All National Office,ou=User Accounts,dc=mydomain,dc=local")
    'map Active Directory objUser to str names'
    strName = objUser.FullName
    strNotes = objuser.Info
    strTitle = objUser.Title
    strPhone = objUser.TelephoneNumber
    strMobile = objUser.Mobile
    strEmail = objUser.mail
    'set pointers for image insertion with linked URL'
    sPicFile = "\\<server>\Office2007ProPlus\Scripts\edin4.png"
    sLinkFile = "test"
    'Use Word (required) to create the format'
    Set objWord = CreateObject("Word.Application")
    Set objDoc = objWord.Documents.Add()
    Set objSelection = objWord.Selection
    objSelection.Style = "No Spacing"
    Set objEmailOptions = objWord.EmailOptions
    Set objSignatureObject = objEmailOptions.EmailSignature
    Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
    'If you get problems with line spacing, use vbNewline instead of Chr(11)'
    'Select what is displayed in the Signature based upon the str to ObjUser mappings above'
    objSelection.Font.Bold = True 
    'objSelection.Font.Name = "Arial"
    objSelection.Font.Size = 11
    if (strCred) Then objSelection.TypeText strName & ", " & strCred Else objSelection.TypeText strName & Chr(32) & strNotes & Chr(11)
    objSelection.Font.Bold = False
    objSelection.TypeText strTitle & Chr(11)
    objSelection.TypeText "test" & Chr(11)
    ' If Telephone number is populated in AD then set and plant Internationally defined number (lines 1 and 2 are only required for the International Signature)
    if (objUser.TelephoneNumber) Then objSelection.TypeText "DD: " & strPhone & Chr(11)
    
    objSelection.Hyperlinks.Add objSelection.Range, "http://www.test.org"
    With objDoc.Styles("Hyperlink").Font
    .Name = "Arial"
    .Bold = False
    '.Underline = wdUnderlineNone
    .Color = RGB(227,114,34)
    End With
    objSelection.TypeParagraph()
    objSelection.TypeParagraph()
    Set objShape1 = objSelection.InlineShapes.AddPicture(sPicFile, True)
    'add the entire range of what you want displayed and set the global font'
    Set objSelection = objDoc.Range()
    objSelection.Font.Name = "Arial"
    'Add a siganture entry, name it and assign to new message'
    objSignatureEntries.Add "Full Signature", objSelection
    objSignatureObject.NewMessageSignature = "Full Signature"
    'Save the content and exit'
    objDoc.Saved = True
    objWord.Quit
    Bizzare, any ideas come to light as I'm debugging as I type?
    Last edited by Rems; 26th January 2012, 12:02.

  • #2
    Re: Script acts different for TS sessions

    Sorted, but not telling because you'll only have a laugh at my expense LOL.

    Comment


    • #3
      Re: Script acts different for TS sessions

      For the benefit of future readers, the solution would be useful.

      However much people laugh, it won't be as much as at the iD10t who pulled a network card from a running PC (and it didn't crash)

      For the avoidance of doubt, said iD10t is a longstanding member and mod here, and lives very close to this poster
      Tom Jones
      MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
      PhD, MSc, FIAP, MIITT
      IT Trainer / Consultant
      Ossian Ltd
      Scotland

      ** Remember to give credit where credit is due and leave reputation points where appropriate **

      Comment


      • #4
        Re: Script acts different for TS sessions

        Originally posted by [URL="http://technet.microsoft.com/en-us/query/cc160913"]http://technet.microsoft.com/en-us/query/cc160913[/URL]

        If Outlook is already open these changes are applied to your default profile;
        this will also be the case if you have only a single Outlook profile.

        If you have multiple Outlook profiles, however, you'll be prompted to select a profile when the script runs.

        To bypass that prompt, just have your script open Outlook with the desired profile.
        For more information go to—where else?—the TechNet Script Center: microsoft.com/technet/scriptcenter/resources/officetips/jun05/tips0614.mspx.

        /The Microsoft Scripting Guys
        .....
        /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


        • #5
          Re: Script acts different for TS sessions

          Originally posted by Rems View Post
          .....
          /Rems
          Pretty much. It also helps if you have a profile setup in the first place.

          Comment


          • #6
            Re: Script acts different for TS sessions

            Originally posted by Ossian View Post
            For the benefit of future readers, the solution would be useful.

            However much people laugh, it won't be as much as at the iD10t who pulled a network card from a running PC (and it didn't crash)

            For the avoidance of doubt, said iD10t is a longstanding member and mod here, and lives very close to this poster
            back in the day, (like, 1997) I had a 386. I was trying to use linux, and the 500MB disk drive I had wasn't detected by the bios. So I couldn't boot off it.
            USB didn't exist back then (at least, not in a 386) and I didn't have a cdrom for it. (Although in hindsight, that may hav ebeen a suitable option!)

            what I did have, was a very old, large, heavy, noisy, clunky MFM drive with an 8bit controller card.

            So every time I needed to restart, I'd plug in the MFM drive. then I'd boot into Dos, fire up LoadLin, then as the linux kernel bootstrapped, quickly rip out the MFM adaptor card and the power to the drive.
            Worked a charm!
            Please do show your appreciation to those who assist you by leaving Rep Point https://www.petri.com/forums/core/im.../icon_beer.gif

            Comment

            Working...
            X