Page 1 of 1 1
Topic Options
#26004 - 2002-07-26 07:48 PM Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
What I'm trying to do is delete any outlook profiles that do not match the @userid as my profiles are created using their Windows NT user id.

I've checked out kdyer's script http://81.17.37.55/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=10;t=000019 but have not had any success. After it deletes the odd profiles it then goes back and deletes the @userid profile.

Hmm.....not too sure where to go from here.
Any ideas?

Chris

Top
#26005 - 2002-07-26 08:04 PM Re: Outlook Profiles
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
are you sure it deletes it? if it is using newprof, it may be overwriting it.

if so, try working it with modprof instead of newprof
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#26006 - 2002-07-26 08:20 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
I guess I should be a little more specific.
I've only used the portion that removes profiles.

I've added the variables as well from the beginning of the script.

If $Profile_Remove = "YES"
; -- If it does not exist, delete out any odd-ball Profiles
; -- Like OEM user, etc.
$index = 0
:loop3
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
; -- Going to check for @userid
IF $keyname <> @userid OR $keyname <> "Sales"
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop3
ENDIF
ENDIF
ENDIF

I have the profile creation down cold but there are some leftover junk in the profile section that I need to clean up.

Top
#26007 - 2002-07-27 07:59 AM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Chris,

Have you tried the new version of the script? It is cleaner.. The old version is still there for ideas of what you can do with scripting.

If needed, have you tried uncommenting the line -

; -- Uncomment for debugging

And then running the script in debug mode?

Back to your point.. You should have at a minimum the following code to remove old profiles:

code:
 $profile_remove = "YES" ; -- Profiles other than @USERID, like OEM User, MS Exchange Settings, etc. removed
$deleteitems = "Yes" ; -- Do you want your users to delete all deleted items on Exit from Outlook?

IF (@inwin = 1) ; -- Is it Winnt or 2K?
; -- Windows NT Registry Locations
$profilelocation = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKLM\Software\Microsoft\Windows NT\CurrentVersion","SystemRoot")
ELSE
; -- Windows 9x Registry Locations
$profilelocation = "HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles"
$windir = READVALUE("HKLM\Software\Microsoft\Windows\CurrentVersion","SystemRoot")
ENDIF

IF $profile_remove = "YES"
; -- If it does not exist, delete out any odd-ball Profiles
; -- Like OEM user, etc.
$index = 0
:loop3
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
; -- Going to check for @userid
IF $keyname <> @userid
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1
GOTO Loop3
ENDIF
ENDIF
ENDIF

HTH,

Kent

[ 27 July 2002, 08:01: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26008 - 2002-07-27 08:27 AM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Hmmm..

Going back and looking at the docs again..

You may want to modify the following line from:
code:
$keyname = ENUMKEY($profilelocation, $index)

to..
code:
$keyname = ENUMKEY( $profilelocation , $index )

You may also need to modify the HKLM, HKCU to be HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER, respectively

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26009 - 2002-07-29 05:41 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
Hey Kent,

I've been able to get it not to delete my @userid profile but now it won't delete the others.
Code is exactly the same same yours.
What seems to happen is it skips 3 lines.
$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
$index = $index + 1

Not sure where to go from here.

Chris

Top
#26010 - 2002-07-29 05:43 PM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
What version of Kixtart are you running? What is the target OS?

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26011 - 2002-07-29 06:13 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
KIX version 4.10 and OS is 2000 Pro
Top
#26012 - 2002-07-29 06:18 PM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Chris,

Is you @userid from the same domain as the NT Login? Or, is it from a "child" or "parent" domain where you may need to trim off your userid?

What does it show when you do a -
code:
?@userid

In a kix script?

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26013 - 2002-07-29 06:47 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
everything is the same Domain.
output of ?@userid is...
@userid
cbeggs

Top
#26014 - 2002-07-29 07:08 PM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
OK...

So, if you look at Regedit for a sec.. You should see..

quote:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles]
"DefaultProfile"="KDyer"

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\kdyer]

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\kdyer\05e2e5caf642f7408f95d6b1e168f6fd]
"001e300a"="contab.dll"
"001e3d13"="{6485D266-C2AC-11D1-AD3E-10A0C911C9C0}"
"00033e03"=hex:23,00,00,00
...

So.. If we take the code and modify it a bit. Note: I added in some TRIM Statements in the event there is a leading or trailing space..

code:
break on cls
?"Current Kix version Shows: " + @kix
?"My @@userid is: " + TRIM(@userid)
?"@@inwin is: " + @inwin
$profile_remove = "YES" ; -- Profiles other than @USERID, like OEM User, MS Exchange Settings, etc. removed

IF @inwin = 1 ; -- Is it Winnt or 2K?
; -- Windows NT Registry Locations
$profilelocation = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
ELSE
; -- Windows 9x Registry Locations
$profilelocation = "HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles"
ENDIF

IF $profile_remove = "YES"
; -- If it does not exist, delete out any odd-ball Profiles
; -- Like OEM user, etc.
$index = 0
:loop3
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
;? "Name found: $KeyName" ; -- Uncomment for debugging
; -- Going to check for @userid
;IF $keyname <> TRIM(@userid)
;$rc = DELTREE($profilelocation+"\"+$keyname)
;$RC = DELKEY($ProfileLocation, $KeyName)
?"key"+$index+": "+$keyname
$index = $index + 1
GOTO Loop3
;ENDIF
ENDIF
ENDIF

We should see the following:

quote:

Current Kix version Shows: 4.10
My @userid is: KDyer
@inwin is: 1
key0: kdyer

For testing, I added in a "test" key and now see:

quote:

Current Kix version Shows: 4.10
My @userid is: KDyer
@inwin is: 1
key0: kdyer
key1: ktest

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26015 - 2002-07-29 07:20 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
This is what I get when I run that code.

My @userid is: cbeggs
@inwin is: 1
key0: cbeggs
key1: Chris Beggs
key2: wacir

Top
#26016 - 2002-07-29 07:25 PM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Chris,

Now, it looks like we are getting somewhere..
quote:

key0: cbeggs - obviously @userid
key1: Chris Beggs - looks like @fullname
key2: wacir - ???

Do you want to use @userid or @fullname? So, you say it re-adds it back in on re-boot..

In your Control Panel, if you look at your mail setup and profiles, what is the default profile: cbeggs or Chris Beggs ?

Is there anything under wacir or is this for testing? We may need to do a DELKEY instead of DELTREE..

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26017 - 2002-07-29 07:34 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
The only one that I want to keep is @userid.
Seeing as this is my box some things get added for testing purposes, ie. wacir.

Currently I don't re-add all profiles as most people in my company don't move around to different desks.

What does happen though is some people have access to group mailboxes for RFP's etc and I'd like to add these mailboxes on logon if they do not exist.

Because of this I also change the reg key to prompt for a profile to be used. Because some people had their email profile set up before KIX and MS's newprof was implemented they will have the default profile of MS Exchange Settings.

Because I want to prompt for a profile to be used I want it to be standard so the user will know what they are supposed to do without calling HelpDesk.

Does this help at all?

Chris

Top
#26018 - 2002-07-29 07:52 PM Re: Outlook Profiles
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Chris,

Instead of have multiple profiles, why not have them do this..

Tool/Services/Microsoft Exchange Server

Click the Properties Button..

Go to the Advanced Tab..

Open these additional Inboxes

Add in the inboxes..

I know this is much harder to script as it puts it under your profile and is using some pretty nasty keycodes..

The way I was able to get around this was to do the following (it uses AutoIT from http://www.hiddensoft.com/autoit ):

code:
             IF INGROUP("LOANSUB")
CLS
COLOR r+/n
?"*******"
?"Creating the LoanSubmission and BrokerDemand Mailboxes"
?"*******"
?"STARTING OUTLOOK - ONE MOMENT PLEASE."
?"*******"
COLOR w+/n
SLEEP 2
RUN($exe) ; -- Start Outlook
SLEEP 1
RUN(@ldrive+"Programs\Meritage\emeritage.exe") ; -- Start AutoIT Script to add additional Inboxes to Outlook
ENDIF

We can probably do alot of this with SENDKEYS and SETFOCUS..

Here is the AutoIT Code:
code:
AdlibOn
;RegRead, TestKey, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE,
;Run, %TestKey%
SetTitleMatchMode, 2
;IfWinActive, Choose Profile, Profile &Name, Send, {ENTER}
;Sleep, 10000
WinActivate, Microsoft Outlook
WinWaitActive, Microsoft Outlook
Send, {F10}{RIGHT 4}{DOWN}v+{TAB}m
WinWaitActive, Services
Send, {TAB 4}{ENTER}
WinWaitActive, Microsoft Exchange Server
Send, +{TAB}{RIGHT}{TAB 2}{ENTER}
WinWaitActive, Add Mailbox
Send, brokerdemand{ENTER 2}
WinWaitActive, Add Mailbox
Send, loansubmi{s 2}ion{ENTER}
WinWaitActive, Microsoft Exchange Server
Send, +{TAB 6}{ENTER}
WinWaitActive, Services
Send, {ESC}
Exit

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#26019 - 2002-07-29 09:02 PM Re: Outlook Profiles
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
Kent,

Although a good solution this is not what management and myself are looking for.

I'll keep playing around and see what I can figure out.

Chris

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 820 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.068 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org