+ Post New Thread
Page 1 of 6 12345 ... LastLast
Results 1 to 15 of 89
Scripts Thread, Outlook profile setup logon script help in Coding and Web Development; Hi I'm using the below example script to apply an outlook profile at logon. It appears to do what I ...
  1. #1
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19

    Outlook profile setup logon script help

    Hi

    I'm using the below example script to apply an outlook profile at logon. It appears to do what I want however would like to be able to set this to run again for all users should I make a change to the prf file. I'm thinking of something along the lines of if a value in the script is incrememted, it will run again.

    Can this be done and if so what do I need to add?

    Code:
    ping 1.1.1.1 -n 1 -w 5000 >NUL
    IF EXIST h:\outlook_profile.txt goto end else
    Outlook_Profile_Created > h:\outlook_profile.txt
    attrib h:\outlook_profile.txt +h
    c:\Program Files (x86)\Microsoft Office\OFFICE11\OUTLOOK.EXE /importprf \\server\share\OutlookProfileSettings.PRF
    :end

  2. #2

    Join Date
    Dec 2008
    Location
    Lancashire
    Posts
    380
    Thank Post
    28
    Thanked 6 Times in 6 Posts
    Rep Power
    13
    Hi. I am only starting with Outlook configs etc. But why would you ping a server first?

    Also, do you redirect the Application Data using Group Policy?

  3. #3
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    The ping command is meant to be an invalid IP address, not a server and is intended to delay the execution of a script [Batch file examples - Wait].

    I have a hybrid RM CC4/Vanilla network but all users are managed through RM usertype policies meaning there is a unique setup of appdata storage/roaming behaviour however it can be redirected through GPO regardless if you require.

  4. #4

    Join Date
    Jan 2012
    Location
    USA
    Posts
    12
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Another way, which I've found the be the easiest, is to use the Outlook Profiler tool. It's not free but saved my bacon when I had to make some crazy changes across different versions of Outlook. Also have roaming profiles gotten better? Seems there is always a profile getting trashed and causing weird errors.

  5. #5
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    I'm not looking at spending any money on this but thanks anyway.

    I'm storing the pst file in the local part of the profile so not relying on this roaming seeing as pst files over the network is a MS no, no.

    Does anyone have any ideas on my original question? I'd also be interested to know whether the profile can be imported without starting Outlook as this halts the login process until the password is entered and Outlook closed!

  6. #6
    MattGibson's Avatar
    Join Date
    May 2008
    Location
    Epsom
    Posts
    169
    Thank Post
    20
    Thanked 11 Times in 8 Posts
    Rep Power
    15
    Hi Guys,

    I use the following script and yes I found it on the web somewhere so I cant take full credit for this!

    Copy Code 1 to your logon.bat located in SYSVOL
    Copy Code 2 to notepad, Save as ".vbs" in SYSVOL
    Copy your pre-made .prf into SYSVOL

    The following script will look for the users directory to see if they already have an Outlook folder in Application Data, if not then the script will proceed with importing the .prf

    In you logon.bat file you'll need to add the following:
    CODE 1
    Code:
    cscript \\SERVER\netlogon\Outlook2007.vbs
    Now copy this to notepad and save as .VBS
    CODE 2
    Code:
    Dim objNetwork, strUserName, WshShell, strDirectory, objFSO
    Dim objShell
    Dim Version
    
    ' Create Outlook object and Shell object
    set objShell = CreateObject("WScript.Shell")
    
    'Get user's name
    Set objNetwork = WScript.CreateObject("WScript.Network")
    strUserName = objNetwork.UserName 
    
    'See if the user needs Outlook configured
    strDirectory = "C:\Documents and Settings\" & strusername & "\Application Data\Microsoft\Outlook"
    
    ' Create the various objects
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'Import PRF
    If objFSO.FolderExists(strDirectory) Then
    'Wscript.Echo "Skipped the registry edits. Directory exists
    Else
    'Wscript.Echo "Start performing registry edits. Directory does not exist
    On Error Resume Next
    Err.Clear
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\First-Run"
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\FirstRun"
    WshShell.RegWrite "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\ImportPRF","\\SERVER\netlogon\Outlook.PRF","REG_SZ"
    'Wscript.Echo "Finished modifying registry
    End If

  7. #7
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Thanks Matt. I haven't gotten round to testing this out yet so apologies for not thanking you sooner. I'll give it a go when I get the chance and get back to you with the results.

    An initial question though. Why are you using a bat file to call a vbs when the vbs can be set to run at logon on its own!? Am I missing something?

  8. #8

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,680
    Thank Post
    3,210
    Thanked 1,030 Times in 955 Posts
    Rep Power
    361
    Quote Originally Posted by randle View Post
    Thanks Matt. I haven't gotten round to testing this out yet so apologies for not thanking you sooner. I'll give it a go when I get the chance and get back to you with the results.

    An initial question though. Why are you using a bat file to call a vbs when the vbs can be set to run at logon on its own!? Am I missing something?
    The bat file is calling the vbs to run using cscript which is different to wscript

    Although if the user launches outlook before said script finishes, does that mess it up some what ??

  9. Thanks to mac_shinobi from:

    randle (24th January 2012)

  10. #9
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Ah thanks. I could see that cscript was used but thought cscript could be called within the initial code of the vbs

  11. #10

    garethedmondson's Avatar
    Join Date
    Oct 2008
    Location
    Gowerton, Swansea
    Posts
    2,258
    Thank Post
    962
    Thanked 324 Times in 192 Posts
    Blog Entries
    11
    Rep Power
    164
    Take a look at this post: Outlook 2010 - Autoconfiguration Issue

    We use an old version of RichProfile. The newer version needs paying for. Shame really as it's an excellent piece of software. I've been testing the free/old one for over 4 months now and am considering moving it out to staff. The only problem I've come across is that it doesn't hold your signatures.

    Gareth

  12. #11
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Looks good although need to be able to add more details than it'll allow i.e. SMTP server. Also does this open Outlook during initial logon? I'm after something that ideally won't open Outlook during the profile creation as my original batch file did this and wouldn't bother looking for a different solution if I didn't want to change this behaviour.

    A little more info:
    Originally I had a different vb script which would load the profile to use, to set Outlook on first use, into the registry but this relied on detecting whether a profile had already been setup as whether to run or not. This didn't work here as the pst file for personal folders is stored in the local part of the profile due to using IMAP and not storing this type of file on a network drive. When a user then logged onto a different computer, the script would detect that the profile already existed and so not run but Outlook then couldn't access the pst file because this was not stored in the roaming part of the profile and not present on this computers local part meaning that errors are displayed and can't send emails...So based on that I'm after a similar script that will run depending on whether a defined folder or file exists.

    It looks like the script that MattGibson provided will do this but just need to test.

  13. #12

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,680
    Thank Post
    3,210
    Thanked 1,030 Times in 955 Posts
    Rep Power
    361
    It looks like the script that MattGibson provided will do this but just need to test.
    VB Script that MattGibson posted looks like it will do the trick, although like you mentioned it does not prompt for SMTP server or any of that.

    Script that MattGibson posted does not by the looks of it execute outlook in anyway as there is nothing that has run or exec in the script that points to the outlook exe

  14. #13
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    My outlook.prf file has all the necessary details to setup the account which looks like is loaded into the registry in the script so hopefully will work a dream

    If interested, the VB script i used orginally was the one at the bottom of this post: Deploy Outlook mail profile settings via GPO or script | HowTo-Outlook but as mentioned simply relied on whether a prfile had been setup rather than the existence of a file/folder.

    Seems that I could have tested this by now instead of replying to posts
    Last edited by randle; 25th January 2012 at 10:39 AM.

  15. Thanks to randle from:

    mac_shinobi (25th January 2012)

  16. #14
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Code:
    Dim objNetwork, strUserName, WshShell, strDirectory, objFSO
    Dim objShell
    Dim Version
    
    ' Create Outlook object and Shell object
    set objShell = CreateObject("WScript.Shell")
    
    'Get user's name
    Set objNetwork = WScript.CreateObject("WScript.Network")
    strUserName = objNetwork.UserName 
    
    'See if the user needs Outlook configured
    strDirectory = "C:\Documents and Settings\" & strusername & "\Application Data\Microsoft\Outlook"
    
    ' Create the various objects
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'Import PRF
    If objFSO.FolderExists(strDirectory) Then
    'Wscript.Echo "Skipped the registry edits. Directory exists
    Else
    'Wscript.Echo "Start performing registry edits. Directory does not exist
    On Error Resume Next
    Err.Clear
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\First-Run"
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\FirstRun"
    WshShell.RegWrite "HKCU\Software\Microsoft\Office\12.0\Outlook\Setup\ImportPRF","\\SERVER\netlogon\Outlook.PRF","REG_SZ"
    'Wscript.Echo "Finished modifying registry
    End If
    Can this be changed to check for a file rather than a directory?

  17. #15
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    594
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Having a little tinker myself I've tried the following modifications to try and do what I ask but on running Outlook it simply looks like it's not set to first-run

    Code:
    Dim objNetwork, strUserName, WshShell, strDirectory, objFSO
    Dim objShell
    Dim Version
    ' Create Outlook object and Shell object
    set objShell = CreateObject("WScript.Shell")
    'Get user's name
    Set objNetwork = WScript.CreateObject("WScript.Network")
    strUserName = objNetwork.UserName 
    'See if the user needs Outlook configured
    'strDirectory = "C:\Users\" & strusername & "AppData\Local\Microsoft\Outlook"
    ' Create the various objects
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Import PRF
    'If objFSO.FolderExists(strDirectory) Then
    If objFSO.FileExists("C:\Users\%username%\AppData\Local\Microsoft\Outlook\outlook.pst") Then
    'Wscript.Echo "Skipped the registry edits. Directory exists
    Else
    'Wscript.Echo "Start performing registry edits. Directory does not exist
    On Error Resume Next
    Err.Clear
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\First-Run"
    WshShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun"
    WshShell.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF","\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf","REG_SZ"
    'Wscript.Echo "Finished modifying registry
    End IF
    The red is obviously my modifications but am I missing something?
    Last edited by randle; 6th February 2012 at 01:52 PM.

SHARE:
+ Post New Thread
Page 1 of 6 12345 ... LastLast

Similar Threads

  1. Logon script help
    By brickwall53 in forum Windows Server 2008 R2
    Replies: 13
    Last Post: 17th June 2011, 11:48 AM
  2. Logon Script Help
    By neon in forum Coding
    Replies: 2
    Last Post: 16th September 2009, 10:48 AM
  3. Logon script not being called... HELP
    By AlexB in forum Windows
    Replies: 6
    Last Post: 28th April 2009, 10:42 AM
  4. HELP! - Logon Scripts
    By Hedghog in forum Windows
    Replies: 2
    Last Post: 26th September 2008, 10:50 AM
  5. Logon Script Help
    By djones in forum Scripts
    Replies: 17
    Last Post: 13th March 2008, 06:00 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •