Hello and this is my first post, so easy on me guys or girls

I have tried to get this to work through GPO's because we have about 1,000 pc's at different locations... I can create the folders under the default users profile in outlook by using the below examples but this needs to be automated through GPO's by use of Windows Setting > Computer Configuration > Scripts (Startup/Shutdown) and here is where the problem occurs… When the vbscript runs at Start Up before the user's desktop loads, Outlook tries to start without the users Default Profile as if it is launching for the first… I have tried pause, wait, sleep and starting Outlook within the script but this does not work at all... I'm open for any suggestions…

This is what I'm using to create the folders in Outlook under the Default User profile inbox

Const olFolderInbox = 6

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set objNewFolder = objFolder.Folders.Add("WHATEVER THE FOLDER NAME")

or

Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(6)
Set myNewFolder = myInboxFolder.Folders.Add("WHATEVER THE FOLDER NAME")

This is what I'm using to start Outlook and run another script with:

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("Select * from __InstanceCreationEvent " _
& " Within 1 Where TargetInstance ISA 'Win32_Process' AND " & _
"TargetInstance.Name = 'Outlook.exe'")

Do While True
Set objProcess = colMonitoredProcesses.NextEvent
objShell.Run "cscript.exe C:\Scripts\Folders.vbs"
Loop

The script runs fine but not through GPO by way of Windows Setting > Computer Configuration > Scripts (Startup/Shutdown) ... Does this look like the only way this is going to work is by using WIWW.... I wanted this to be an easy one for a change...

Thanks Rob
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Since this is a user-based change, should you not be using 'User Configuration' rather than 'Computer Configuration'?
Answered 02/23/2009 by: VBScab
Red Belt

Please log in to comment
0
thanks VBScab, method K.I.S.S...
Answered 02/23/2009 by: RoBolton
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity