/build/static/layout/Breadcrumb_cap_w.png

vbscript to create outlook folders on startup through GPO...

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

Answers (2)

Posted by: anonymous_9363 15 years ago
Red Belt
0
Since this is a user-based change, should you not be using 'User Configuration' rather than 'Computer Configuration'?
Posted by: RoBolton 15 years ago
Senior Yellow Belt
0
thanks VBScab, method K.I.S.S...
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ