GuidesExchange (Outlook Client) Modification with SMS Installer

Exchange (Outlook Client) Modification with SMS Installer

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




by Ben Dixon

Recently, I have been working on scripts to modify the profile settings for
Microsoft Exchange clients (Exchange or Outlook). This is especially
useful if you need to change the location of all users’ PST files at
once.
Recently, I have been working on scripts to modify the profile settings for Microsoft Exchange clients (Exchange or Outlook). This is especially useful if you need to change the location of all users’ PST files at once.

There are a number of registry entries that must be modified to
script changes to the Exchange profile (actually the Windows
Messaging Subsystem profile) These entries are found, in Windows NT,
at HKEY_CURRENT_USERSoftwareMicrosoftWindows
NTCurrentVersionWindows Messaging SubsystemProfiles, and in
Windows 95, at HKEY_CURRENT_USERSoftwareMicrosoftWindows
Messaging SubsystemProfiles.

item: Check Configuration
Flags=10100000
end
item: Set
Variable
Variable=PROFILES
Value=Windows
NTCurrentVersionWindows Messaging
SubsystemProfiles
end
item: Else Statement
end
item:
Set Variable
Variable=PROFILES
Value=Windows Messaging
SubsystemProfiles
end
item: End Block
end

1. Get the default profile. This is found in
..ProfilesDefaultProfile = . Once you
have this value, you can reference this profile in all your registry
calls.

item: Get Registry Key
Value
Variable=DEFAULTPROFILE
Key=SoftwareMicrosoft%PROFILES%
Value
Name=DefaultProfile
Flags=00000010
end

2. You must be able to call the value for each service to
determine if it is a PST. To do this, you reference the Profile
Identifier PR_STORE_PROVIDERS. SMS Installer will only handle 32
bits before it runs into another application’s memory space, and
then you have a mess. So, you must get the value and parse the first
32 bits.

item: Get Registry Key
Value
Variable=PROFILEID
Key=SoftwareMicrosoft%PROFILES%%DEFAULTPROFILE%9207f3e0a3b11019908b08002b2a56c2
Value
Name=01023d00
Flags=00000010
end

item: If/While
Statement
Variable=PROFILEID
Flags=00110001
end
item:
Parse
String
Source=%PROFILEID%
Pattern=32
Variable1=PART1
Variable2=PART2
Flags=00001000
end

3. Now you can get the Identifier for the service and modify it
if it meets the criteria for a PST.

item: Get Registry Key
Value
Variable=SRVCPTR
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%%PART1%
Value
Name=001e3d09
Flags=00000010
end
item: If/While
Statement
Variable=SRVCPTR
Value=MSPST
MS
Flags=00000100
end

4. If the service is a PST:

item: Get Registry Key
Value
Variable=PST1
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%%PART1%
Value
Name=001e6700
Flags=00000010
end
item: Set
Variable
Variable=PST1
Value=%PST1%
Flags=00011000
end

5. You can make the changes you wish to make. For instance, I
want to find all PST services that are on a server named PINBALL. If
I find services pointing to PINBALL, I want them to point to
FUSSBALL (in this case, a statically mapped M: drive).

item: If/While
Statement
Variable=PST1
Value=PINBALLPSTFILES
Flags=00000010
end
item:
Add Text to INSTALL.LOG
Text= Old path to PST:
%PST1%
end

-I parse the value 18 places from the left, knocking off the
server and share name.
item: Parse
String
Source=%PST1%
Pattern=18
Variable2=PSTPART
Flags=00001000
end

-I create the new value to replace the old server name, in this
case, a drive letter.
item: Set
Variable
Variable=NEWPST
Value=M:
end

-I append the drive letter with the folder and filename of the
PST.
item: Set
Variable
Variable=NEWPST
Value=%PSTPART%
Flags=00000001
end

-Then I check to see that thr target file exists before I modify
the path in the registry:
item: Check if File/Dir
Exists
Pathname=%NEWPST%
Message=Error
102
Message=
Message=The file %NEWPST% could not be found.
Either the file does not exist or the path th the file is incorrect.
Contact the Help Desk for assistance. Do not forget to mention the
error code when you call.
Title=File Not
Found
Flags=00000101
end

If the file is not found, we don’t modify the registry. If it is
found, we get another registry key, this time, a BINHEX key (BE VERY
CAREFUL MODIFYING THIS ONE!)

(If you open the registry using regedit, you can type the value
you want on the right, and its corresponding BINHEX value will
appear on the left)

item: Else Statement
end
item: Get Registry Key
Value
Variable=REG_VALU
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%%PART1%
Value
Name=01020FFF
Flags=00000010
end
item: Set
Variable
Variable=REG_VALU
Value=%REG_VALU%
end
item:
Parse
String
Source=%REG_VALU%
Pattern=142
Variable1=PART3
Variable2=PART4
Flags=00001000
end
item:
Set Variable
Variable=PART4
Value=%PART4%
end
remarked
item: Read/Update Text
File
Variable=TEXTREG
Pathname=textreg.txt
end

-In this case, I hardcode the value, because I cannot read this
many bits into the variable from an external file without a memory
overflow (A GP Fault)
item: Set
Variable
Variable=TEXTREG
Value=0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E0000004D3A
end
item:
Set
Variable
Variable=TEXTREG
Value=%PART4%
Flags=00000001
end
item:
End Block
end

And, when we’re done, we edit the registry:
item: Edit
Registry
Total Keys=2
item:
Key
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%%PART1%
New
Value=%NEWPST%
Value Name=001e6700
Root=1
end
item:
Key
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%%PART1%
New
Value=%TEXTREG%
Value Name=01020fff
Root=1
Data
Type=4
end
end

You may also wish to change the AutoArchive path if you have
it set to Autoarchive to the old server:

item: Get Registry Key
Value
Variable=PR_ARCHFILE
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%a0d020000000000c000000000000046
Value
Name=001e0324
Flags=00000010
end
item: If/While
Statement
Variable=PR_ARCHFILE
Value=
Flags=00000010
end
item:
Set
Variable
Variable=PR_ARCHFILE
Value=%PR_ARCHFILE%
end
item:
Parse
String
Source=%PR_ARCHFILE%
Pattern=18
Variable2=ARCH2
Flags=00001000
end
item:
Set Variable
Variable=NEWARCH
Value=M:
end
item: Set
Variable
Variable=NEWARCH
Value=%ARCH2%
Flags=00000001
end

-Once again. Why change the path in the service if the service
won’t point to anything? Check to see if the file exists on the
target server before you change the registry.
item: Check if
File/Dir Exists
Pathname=%NEWARCH%
Message=Error
101
Message=
Message=The file %NEWARCH% could not be found.
Either the file does not exist or the path th the file is incorrect.
Contact the Help Desk for assistance. Do not forget to mention the
error code when you call.
Title=File Not
Found
Flags=00000101
end
item: Add Text to
INSTALL.LOG
Text= Error 101: %NEWARCH% does not
exist.
end
item: Else Statement
end
item: Edit
Registry
Total
Keys=1
Key=SoftwareMicrosoft%PROFDIR%%DEFAULTPROFILE%a0d020000000000c000000000000046
New
Value=%NEWARCH%
New Value=
Value
Name=001e0324
Root=1
end
item: Add Text to
INSTALL.LOG
Text= New Autoarchive PST:
%NEWARCH%
end
item: End Block
end
item: End Block
end

Experiment with these lines in SMS Installer and see how it works
for you.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories