Ik heb zoiets soortgelijks gemaakt maar dan in twee delen. Ik heb één scriptje dat de signatures genereerd, en ik heb één script dat de signatures koppelt aan de user accounts.
Het signature creeeerende script kan ik niet laten zien omdat het teveel van andere code afhangt die ik niet mag publiceren, het andere script is ongeveer dit (ruwweg, de productie versie heb ik niet bij de hand op het moment):
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| ' On Error Resume Next
'
' Outlook 2003 signature setter - this sets the signature for all accounts
'
Const HKCU = &H80000001 'HKEY_CURRENT_USER
Const PROFPATH = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" ' OL profile path
' Create an registry object
Set objReg = GetObject("winmgmts:root/default:StdRegProv")
'
' List all profiles configured for MAPI
'
Sub ListProfiles()
' Open the registry
rCode = objReg.EnumKey(HKCU, _
PROFPATH, _
regKeys)
' Now loop through all configured profiles
For Each sKey in regKeys
ScanMapiServices PROFPATH, sKey
Next
End Sub
'
' Returns the current user as a string
'
Function GetCurrentUser()
Set tmpObj = CreateObject("WScript.Network")
End Function
'
' Found an profile, lets find the exchange provider
'
Sub ScanMapiServices(baseKey, sKey)
' Determine the base
baseKey = baseKey & "\" & sKey & "\9375CFF0413111d3B88A00104B2A6676"
' Open the registry
rCode = objReg.EnumKey(HKCU, _
baseKey, _
regKeys)
' Now loop through all configured profiles
For Each tmpKey in regKeys
' Enumerate the value of the configured MAPI Providers
objReg.GetDWORDValue HKCU, _
baseKey & "\" & tmpKey, _
"MAPI Provider", _
mapiProvider
' if we found an '5' - its the Exchange provider, and we add our signature
If( mapiProvider = 5 ) Then
AddSignature baseKey & "\" & tmpKey
End If
Next
End Sub
'
' Converts a string value to an binary array
' function taken from: http://groups.google.nl/groups?hl=nl&lr=&selm=OqSpLYCkEHA.1764%40TK2MSFTNGP10.phx.gbl
'
Function ToByteArray(ByVal sString)
ReDim aBytes(Len(sString) * 2 + 1)
iIndex = -1
For iPos = 1 To Len(sString)
iIndex = iIndex + 1
aBytes(iIndex) = Asc(Mid(sString, iPos, 1))
' add a 0 after each letter
iIndex = iIndex + 1
aBytes(iIndex) = 0
Next
' add two closing 0's
iIndex = iIndex + 1
aBytes(iIndex) = 0
iIndex = iIndex + 1
aBytes(iIndex) = 0
ToByteArray = aBytes
End Function
'
' Found the Exchange MAPI Provider - change the signature in it
'
Sub AddSignature(baseKey)
tmpSig = GetCurrentUser() & "_Group_Signature"
objReg.SetBinaryValue HKCU, _
baseKey, _
"New Signature", _
ToByteArray( tmpSig )
End Sub
ListProfiles |