+ Post New Thread
Page 3 of 6 FirstFirst 123456 LastLast
Results 31 to 45 of 89
Scripts Thread, Outlook profile setup logon script help in Coding and Web Development; This script from the link I provided on the first page works fine and even gives a machanism to push ...
  1. #31
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    595
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    This script from the link I provided on the first page works fine and even gives a machanism to push out an update should the prf be modified but checks for whether the profile has already been setup rather than whether a file exists meaning that it won't run again when logging onto a different computer. I had hoped that it could be modified to do this but again am a little lost.

    Code:
    'This script determines if a specified mail profile already exists.
    'If it doesn't, it will set the path to the prf-file containing
    'the mail profile configuration settings.
    'Script created by: Robert Sparnaaij
    'For more information about this file see;
    'http://www.howto-outlook.com/howto/deployprf.htm
    
    '=====BEGIN EDITING=====
    'Name of mail profile as in the prf-file
    ProfileName = "CVHS IMAP Profile"
    'Path to the prf-file
    ProfilePath = "\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf"
    'Increase the ProfileVersion whenever you want to reapply the prf-file
    ProfileVersion = 3
    '======STOP EDITING UNLESS YOU KNOW WHAT YOU ARE DOING=====
    const HKEY_CURRENT_USER = &H80000001
    const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & _
        strComputer & "\root\default:StdRegProv")
     
    strKeyProfilePath = _ 
     "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" _ 
     & ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
    strLastChangeVer = "LastChangeVer"
    objRegistry.GetBinaryValue _
     HKEY_CURRENT_USER,strKeyProfilePath,strLastChangeVer,strValueLastChangeVer
    If ProfileVersion > 1 Then
        strKeyProfileVersionPath = "SOFTWARE\HowTo-Outlook\DeployPRF"
        strProfileVersionName = ProfileName
        objRegistry.GetDWORDValue _
         HKEY_CURRENT_USER,strKeyProfileVersionPath,strProfileVersionName,strValueProfileVersion
        If IsNull(strValueProfileVersion) OR ProfileVersion > strValueProfileVersion Then
     ReapplyPrf = True
        End If
    End If
    If IsNull(strValueLastChangeVer) OR ReapplyPrf Then
        'The mail profile doesn't exist yet so we'll set the the ImportPRF key and remove the FirstRun keys
        'Determine path to outlook.exe
        strKeyOutlookAppPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE"
        strOutlookPath = "Path"
        objRegistry.GetStringValue _
         HKEY_LOCAL_MACHINE,strKeyOutlookAppPath,strOutlookPath,strOutlookPathValue
        'Verify that the outlook.exe and the configured prf-file exist
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        If objFSO.FileExists(strOutlookPathValue & "outlook.exe") AND objFSO.FileExists(ProfilePath) Then
     'Determine version of Outlook
     strOutlookVersionNumber = objFSO.GetFileVersion(strOutlookPathValue & "outlook.exe")
     strOutlookVersion = Left(strOutlookVersionNumber, inStr(strOutlookVersionNumber, ".0") + 1)
     'Create the Setup key, set the ImportPRF value and delete the First-Run values.
     strKeyOutlookSetupPath = "SOFTWARE\Microsoft\Office\" & strOutlookVersion & "\Outlook\Setup"
     strImportPRFValueName = "ImportPRF"
     strImportPRFValue = ProfilePath
     objRegistry.CreateKey HKEY_CURRENT_USER,strKeyOutlookSetupPath
     objRegistry.SetStringValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strImportPRFValueName,strImportPRFValue
     strFirstRunValueName = "FirstRun"
     objRegistry.DeleteValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strFirstRunValueName
     strFirstRun2ValueName = "First-Run"
     objRegistry.DeleteValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strFirstRun2ValueName
     'Save the applied ProfileVersion if larger than 1.
     If ProfileVersion > 1 Then
         objRegistry.CreateKey HKEY_CURRENT_USER,strKeyProfileVersionPath
         objRegistry.SetDWORDValue HKEY_CURRENT_USER,_
      strKeyProfileVersionPath,strProfileVersionName,ProfileVersion
     End If
        Else 
            Wscript.Echo "Crucial file in script could not be found." &vbNewLine & _
            "Please contact your system administrator." 
        End If
    Else
        'The mail profile already exists so there is no need to launch Outlook with the profile switch.
        'Of course you are free to do something else here with the knowledge that the mail profile exists.
    End If
    'Cleaup
    Set objRegistry = Nothing
    Set objFSO = Nothing

  2. #32
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    595
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Quote Originally Posted by Steve21 View Post
    Runs without errors here (Just commented out the regdeeltes so I didn't kill my pc, but should be fine).

    Does that work for you?

    Steve
    It's definitely not liking line 23 character 15 which is the "On Error..." line

    I take it I should still be calling this script through cscript?

    Anyway, I've commented out the "HandleError" lines for the time being seeing as it's not happy with this and the script now moves on but stops at the first RegDelete line with the message "Unable to remove registry key "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup \First-Run"

  3. #33

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by randle View Post
    It's definitely not liking line 23 character 15 which is the "On Error..." line

    I take it I should still be calling this script through cscript?

    Anyway, I've commented out the "HandleError" lines for the time being seeing as it's not happy with this and the script now moves on but stops at the first RegDelete line with the message "Unable to remove registry key "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup \First-Run"
    The one I copied doesn't have those lines if you look at the code section on that comment.

    I'd suggest the problem is that you have no trailing \ on it. "Generally" \ means delete all hierarchy too, if there is a key inside it, aka Default etc it won't delete without it.

    Try this one:

    Code:
    Dim objNetwork, strUserName, strDirectory, objFSO
    Dim objShell
    Dim Version
    ' Create required objects ie Shell, FileSystemObject and Network
    set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objNetwork = WScript.CreateObject("WScript.Network")
    
    'Get user's name
    strUserName = objNetwork.UserName 
    
    'See if the user needs Outlook configured
    'strDirectory = "C:\Users\" & strusername & "AppData\Local\Microsoft\Outlook"
    
    'Import PRF
    If objFSO.FileExists("C:\Users\" & strUserName & "\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
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\First-Run\"
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun\"
    objShell.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF","\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf","REG_SZ"
    End IF
    Can't test it here I'm afraid

    Steve

  4. Thanks to Steve21 from:

    mac_shinobi (8th February 2012)

  5. #34

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by Steve21 View Post
    The one I copied doesn't have those lines if you look at the code section on that comment.

    I'd suggest the problem is that you have no trailing \ on it. "Generally" \ means delete all hierarchy too, if there is a key inside it, aka Default etc it won't delete without it.

    Try this one:

    Code:
    Dim objNetwork, strUserName, strDirectory, objFSO
    Dim objShell
    Dim Version
    ' Create required objects ie Shell, FileSystemObject and Network
    set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objNetwork = WScript.CreateObject("WScript.Network")
    
    'Get user's name
    strUserName = objNetwork.UserName 
    
    'See if the user needs Outlook configured
    'strDirectory = "C:\Users\" & strusername & "AppData\Local\Microsoft\Outlook"
    
    'Import PRF
    If objFSO.FileExists("C:\Users\" & strUserName & "\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
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\First-Run\"
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun\"
    objShell.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF","\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf","REG_SZ"
    End IF
    Can't test it here I'm afraid

    Steve
    Thank's for letting me know ref vbs and no error handling with ref to on error go to etc. Learning all the time

    Also the last if else statement, how would you make it so that if the file does not exist ie

    If <> objFSO.FileExist("Path") Then
    write reg
    write reg
    delete reg
    End If

    As he is not doing anything otherwise, just to neaten the code up, that or use a select case but then we would need to know how FileExist returns ie true or false or 1 or 0 or what exactly

  6. #35

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by mac_shinobi View Post
    Thank's for letting me know ref vbs and no error handling with ref to on error go to etc. Learning all the time

    Also the last if else statement, how would you make it so that if the file does not exist ie

    If <> objFSO.FileExist("Path") Then
    write reg
    write reg
    delete reg
    End If

    As he is not doing anything otherwise, just to neaten the code up, that or use a select case but then we would need to know how FileExist returns ie true or false or 1 or 0 or what exactly
    You mean doing it without the "if exists do nothing" bit?

    Code:
    If objFSO.FileExists("path") = False Then
    Steve

  7. #36

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by Steve21 View Post
    You mean doing it without the "if exists do nothing" bit?

    Code:
    If objFSO.FileExists("path") = False Then
    Steve
    current code :
    Code:
    If objFSO.FileExists("C:\Users\" & strUserName & "\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 
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\First-Run\" 
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun\" 
    objShell.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF","\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf","REG_SZ" 
    End IF
    Which has a wscript.echo commented out and no other code to execute in the section if the file does exist, so yes, if it is false then write the reg entries otherwise carry on with the remainder code
    Last edited by mac_shinobi; 8th February 2012 at 04:53 PM.

  8. #37

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by mac_shinobi View Post
    current code :
    Code:
    If objFSO.FileExists("C:\Users\" & strUserName & "\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 objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\First-Run\" objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun\" objShell.RegWrite "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\ImportPRF","\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf","REG_SZ" End IF
    Which has a wscript.echo commented out and no other code to execute in the section if the file does exist, so yes, if it is false then write the reg entries otherwise carry on with the remainder code
    Aye just do it as a:

    Code:
    If objFSO.FileExists("path") = False Then
    "Do Delete and Stuff"
    End if

  9. Thanks to Steve21 from:

    mac_shinobi (8th February 2012)

  10. #38
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    595
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Ok, Ok, I'm using your one Steve21 and although the registry "First-Run..." is deleted, the script gets stuck here with the error "Unable to remove registry key "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup \First-Run", Code: 80070002, Source WshShell.RegDelete. Because of this the RegWrite doesn't get added...

  11. #39

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by randle View Post
    Ok, Ok, I'm using your one Steve21 and although the registry "First-Run..." is deleted, the script gets stuck here with the error "Unable to remove registry key "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup \First-Run", Code: 80070002, Source WshShell.RegDelete. Because of this the RegWrite doesn't get added...
    1. When executing the script you are using cscript as the interpreter ie so you are using a bat file to execute the vbs using cscript.exe
    2. On the machine , does the user account you are using have access rights to delete or write to the registry ?

    So if you manually navigate to the registry key if it exists, right click on key or sub key --> permissions and said user account has relevant access rights ( read / write / delete etc )

    Also noticed, not sure if it was an accident but there is a space in the reg key

    "HKCU\Software\Microsoft\Office\14.0\Outlook\S etup \First-Run"

    Or was that you typing the key ??

    Also I presume the path to the reg key you have gotten rid of the last back slashes so it is :

    Code:
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun"
    Instead of
    Code:
    objShell.RegDelete "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup\FirstRun\"
    Last edited by mac_shinobi; 8th February 2012 at 05:15 PM.

  12. #40

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by randle View Post
    This script from the link I provided on the first page works fine and even gives a machanism to push out an update should the prf be modified but checks for whether the profile has already been setup rather than whether a file exists meaning that it won't run again when logging onto a different computer. I had hoped that it could be modified to do this but again am a little lost.

    Code:
    'This script determines if a specified mail profile already exists.
    'If it doesn't, it will set the path to the prf-file containing
    'the mail profile configuration settings.
    'Script created by: Robert Sparnaaij
    'For more information about this file see;
    'http://www.howto-outlook.com/howto/deployprf.htm
    
    '=====BEGIN EDITING=====
    'Name of mail profile as in the prf-file
    ProfileName = "CVHS IMAP Profile"
    'Path to the prf-file
    ProfilePath = "\\MyServer\Outlook Profiles\CVHS IMAP Profile.prf"
    'Increase the ProfileVersion whenever you want to reapply the prf-file
    ProfileVersion = 3
    '======STOP EDITING UNLESS YOU KNOW WHAT YOU ARE DOING=====
    const HKEY_CURRENT_USER = &H80000001
    const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & _
        strComputer & "\root\default:StdRegProv")
     
    strKeyProfilePath = _ 
     "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" _ 
     & ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
    strLastChangeVer = "LastChangeVer"
    objRegistry.GetBinaryValue _
     HKEY_CURRENT_USER,strKeyProfilePath,strLastChangeVer,strValueLastChangeVer
    If ProfileVersion > 1 Then
        strKeyProfileVersionPath = "SOFTWARE\HowTo-Outlook\DeployPRF"
        strProfileVersionName = ProfileName
        objRegistry.GetDWORDValue _
         HKEY_CURRENT_USER,strKeyProfileVersionPath,strProfileVersionName,strValueProfileVersion
        If IsNull(strValueProfileVersion) OR ProfileVersion > strValueProfileVersion Then
     ReapplyPrf = True
        End If
    End If
    If IsNull(strValueLastChangeVer) OR ReapplyPrf Then
        'The mail profile doesn't exist yet so we'll set the the ImportPRF key and remove the FirstRun keys
        'Determine path to outlook.exe
        strKeyOutlookAppPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE"
        strOutlookPath = "Path"
        objRegistry.GetStringValue _
         HKEY_LOCAL_MACHINE,strKeyOutlookAppPath,strOutlookPath,strOutlookPathValue
        'Verify that the outlook.exe and the configured prf-file exist
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        If objFSO.FileExists(strOutlookPathValue & "outlook.exe") AND objFSO.FileExists(ProfilePath) Then
     'Determine version of Outlook
     strOutlookVersionNumber = objFSO.GetFileVersion(strOutlookPathValue & "outlook.exe")
     strOutlookVersion = Left(strOutlookVersionNumber, inStr(strOutlookVersionNumber, ".0") + 1)
     'Create the Setup key, set the ImportPRF value and delete the First-Run values.
     strKeyOutlookSetupPath = "SOFTWARE\Microsoft\Office\" & strOutlookVersion & "\Outlook\Setup"
     strImportPRFValueName = "ImportPRF"
     strImportPRFValue = ProfilePath
     objRegistry.CreateKey HKEY_CURRENT_USER,strKeyOutlookSetupPath
     objRegistry.SetStringValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strImportPRFValueName,strImportPRFValue
     strFirstRunValueName = "FirstRun"
     objRegistry.DeleteValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strFirstRunValueName
     strFirstRun2ValueName = "First-Run"
     objRegistry.DeleteValue HKEY_CURRENT_USER,_
          strKeyOutlookSetupPath,strFirstRun2ValueName
     'Save the applied ProfileVersion if larger than 1.
     If ProfileVersion > 1 Then
         objRegistry.CreateKey HKEY_CURRENT_USER,strKeyProfileVersionPath
         objRegistry.SetDWORDValue HKEY_CURRENT_USER,_
      strKeyProfileVersionPath,strProfileVersionName,ProfileVersion
     End If
        Else 
            Wscript.Echo "Crucial file in script could not be found." &vbNewLine & _
            "Please contact your system administrator." 
        End If
    Else
        'The mail profile already exists so there is no need to launch Outlook with the profile switch.
        'Of course you are free to do something else here with the knowledge that the mail profile exists.
    End If
    'Cleaup
    Set objRegistry = Nothing
    Set objFSO = Nothing
    What do you need doing to this script or what is it doing or not doing that you need etc ?

  13. #41

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by randle View Post
    Ok, Ok, I'm using your one Steve21 and although the registry "First-Run..." is deleted, the script gets stuck here with the error "Unable to remove registry key "HKCU\Software\Microsoft\Office\14.0\Outlook\Setup \First-Run", Code: 80070002, Source WshShell.RegDelete. Because of this the RegWrite doesn't get added...
    Suggests the key/path doesn't exist, as you have no error checking to ensure if it exists before deleting it.

    I'm assuming if you re-run the script now, it'll error on the first line too as that no longer exists? (Assuming it's not been re-created).

    Really you want to ensure the keys exist before deleting them, as you're only checking the main path, not each key.

    Steve

  14. #42
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    595
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    I'm using cscript as the interpreter through the batch file that calls the vbs

    I'm running this as a domain adminstrator for testing purposes so have full control of the registry

    I think the space must have been added by the site formatting as don't have a space in my script

    There is no backslash at the end of the reg keys.

    I probably shouldn't have posted the other script as am just adding more problems This script checked for whether the profile has already been setup rather than whether a file exists so isn't so effective when using an IMAP setup that requires a personal data file on the local computer to work properly. This file (outlook.pst) is added through the prf file via logon script but obviously needs to run on each computer which won't happen due to the HKCU showing that the profile has already been setup and so not running again hence why I'm looking at a file checking method instead.

    Suggests the key/path doesn't exist, as you have no error checking to ensure if it exists before deleting it.

    I'm assuming if you re-run the script now, it'll error on the first line too as that no longer exists? (Assuming it's not been re-created).

    Really you want to ensure the keys exist before deleting them, as you're only checking the main path, not each key.
    I thought that might be the case but again am a little clueless on how to implement this although looking at the registry location, the "First-Run" value does exist so not sure why this can't be deleted

  15. #43

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by randle View Post
    I'm using cscript as the interpreter through the batch file that calls the vbs

    I'm running this as a domain adminstrator for testing purposes so have full control of the registry

    I think the space must have been added by the site formatting as don't have a space in my script

    There is no backslash at the end of the reg keys.

    I probably shouldn't have posted the other script as am just adding more problems This script checked for whether the profile has already been setup rather than whether a file exists so isn't so effective when using an IMAP setup that requires a personal data file on the local computer to work properly. This file (outlook.pst) is added through the prf file via logon script but obviously needs to run on each computer which won't happen due to the HKCU showing that the profile has already been setup and so not running again hence why I'm looking at a file checking method instead.



    I thought that might be the case but again am a little clueless on how to implement this although looking at the registry location, the "First-Run" value does exist so not sure why this can't be deleted
    If you could list what you want the script to do ie

    Check registry keys exist for ones you want to create, if they do then don't re create them, if they don't then create them
    Check registry keys for the ones you want deleting, if they don't exist, ignore, if they do then delete them.

    Check for the existance of the prf file in said location, if it does not exist then copy the prf file from your server to the client, if it does then ignore and continue

    What other things need to be done ??

  16. #44
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    595
    Thank Post
    66
    Thanked 16 Times in 15 Posts
    Rep Power
    19
    Basically the same:

    Check whether "C:\Users\%username%\AppData\Local\Microsoft\Outlo ok\outlook.pst" exists and if not then delete the First-Run/FirstRun values (if they exist) and load up the "ImportPRF" value

    Going back to the previous script, how do I add in checking for whether the value exists before attempting to delete it like Steve21 suggests as this seems to be what's causing the script to halt!

  17. #45

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,762
    Thank Post
    3,271
    Thanked 1,053 Times in 974 Posts
    Rep Power
    365
    Quote Originally Posted by randle View Post
    Basically the same:

    Check whether "C:\Users\%username%\AppData\Local\Microsoft\Outlo ok\outlook.pst" exists and if not then delete the First-Run/FirstRun values (if they exist) and load up the "ImportPRF" value

    Going back to the previous script, how do I add in checking for whether the value exists before attempting to delete it like Steve21 suggests as this seems to be what's causing the script to halt!
    I would use the 3rd chunk of code ( function ) as per here :

    Checking if Registry Key's or Value's exist - VBScript FAQ - Tek-Tips

    Taking into consideration that the last back slash of the registry path will indicate to the script if you are looking for a key or a value

    'Requirements: The registry key/value you are looking for (RegistryItem)
    'Note: RegistryItem MUST end in a backslash (\) if you are looking for a key
    ' RegistryItem's without a backslash (\) will assume you are looking for a value
    Function RegistryItemExists (RegistryItem)
    'If there isnt the item when we read it, it will return an error, so we need to resume
    On Error Resume Next
    2 Shorter ways of the 3rd function from the first site here :

    http://yorch.org/2011/10/two-ways-to...sing-vbscript/
    Last edited by mac_shinobi; 9th February 2012 at 11:14 AM.

SHARE:
+ Post New Thread
Page 3 of 6 FirstFirst 123456 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
  •