Beste,
Ik ben bezig met een script om ervoor te zorgen dat bij gebruikers binnen onze organisatie een bepaalde handtekening als standaard bij nieuwe en beantwoorde emails word gebruikt in Outlook 2007.
Nu heb ik dit werkend bij de gewone werkstations, echter bij gebruikers die inloggen op onze terminal servers (Windows 2003 r2) blijf ik steeds de melding krijgen 'Please shut down Outlook before running this script'
Ik heb me hier inmiddels ook op google zitten zoeken maar tot nu toe ben ik maar ergens 1 topic tegen gekomen met het zelfde probleem, echter die dateert uit januari 2009 maar totaal geen reacties daar verder.
Kan iemand mij hiermee helpen?
Ik ben bezig met een script om ervoor te zorgen dat bij gebruikers binnen onze organisatie een bepaalde handtekening als standaard bij nieuwe en beantwoorde emails word gebruikt in Outlook 2007.
Nu heb ik dit werkend bij de gewone werkstations, echter bij gebruikers die inloggen op onze terminal servers (Windows 2003 r2) blijf ik steeds de melding krijgen 'Please shut down Outlook before running this script'
Ik heb me hier inmiddels ook op google zitten zoeken maar tot nu toe ben ik maar ergens 1 topic tegen gekomen met het zelfde probleem, echter die dateert uit januari 2009 maar totaal geen reacties daar verder.
Kan iemand mij hiermee helpen?
Visual Basic:
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
| '==================== ' ' VBScript: <defaultSignature.vbs> ' This script will think that the correct signatures are already in the folder " %appdata%\Microsoft\Handtekeningen " '==================== 'Option Explicit On Error Resume Next Call SetDefaultSignature("handtekening2011","") Sub SetDefaultSignature(strSigName, strProfile) Const HKEY_CURRENT_USER = &H80000001 strComputer = "." If Not IsOutlookRunning Then Set objreg = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Windows NT\" & _ "CurrentVersion\Windows " & _ "Messaging Subsystem\Profiles\" ' get default profile name if none specified If strProfile = "" Then objreg.GetStringValue HKEY_CURRENT_USER, _ strKeyPath, "DefaultProfile", strProfile End If ' build array from signature name myArray = StringToByteArray(strSigName, True) strKeyPath = strKeyPath & strProfile & _ "\9375CFF0413111d3B88A00104B2A6676" objreg.EnumKey HKEY_CURRENT_USER, strKeyPath, _ arrProfileKeys For Each subkey In arrProfileKeys strsubkeypath = strKeyPath & "\" & subkey 'On Error Resume Next objreg.SetBinaryValue HKEY_CURRENT_USER, _ strsubkeypath, "New Signature", myArray objreg.SetBinaryValue HKEY_CURRENT_USER, _ strsubkeypath, "Reply-Forward Signature", myArray Next Else strMsg = "Please shut down Outlook before " & _ "running this script." MsgBox strMsg, vbExclamation, "SetDefaultSignature" End If End Sub Function IsOutlookRunning() strComputer = "." strQuery = "Select * from Win32_Process " & _ "Where Name = 'Outlook.exe'" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery(strQuery) For Each objProcess In colProcesses If UCase(objProcess.Name) = "OUTLOOK.EXE" Then IsOutlookRunning = True Else IsOutlookRunning = False End If Next End Function Public Function StringToByteArray _ (Data, NeedNullTerminator) Dim strAll strAll = StringToHex4(Data) If NeedNullTerminator Then strAll = strAll & "0000" End If intLen = Len(strAll) \ 2 ReDim arr(intLen - 1) For i = 1 To Len(strAll) \ 2 arr(i - 1) = CByte _ ("&H" & Mid(strAll, (2 * i) - 1, 2)) Next StringToByteArray = arr End Function Public Function StringToHex4(Data) ' Input: normal text ' Output: four-character string for each character, ' e.g. "3204" for lower-case Russian B, ' "6500" for ASCII e ' Output: correct characters ' needs to reverse order of bytes from 0432 Dim strAll For i = 1 To Len(Data) ' get the four-character hex for each character strChar = Mid(Data, i, 1) strTemp = Right("00" & Hex(AscW(strChar)), 4) strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2) Next StringToHex4 = strAll End Function |
[Voor 0% gewijzigd door alt-92 op 23-06-2011 17:35]