Syrup Beaver
pants log
Have it ECHO %ProgFiles& to your logfile to see what the variable you're setting looks like, running your start command on my machine works otherwise.
Have it ECHO %ProgFiles& to your logfile to see what the variable you're setting looks like, running your start command on my machine works otherwise.
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "Communicator" /t REG_SZ /d """"%ProgFiles%\Microsoft Office Communicator\communicator.exe"""" /f
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' File: Users-Communicator Settings.vbs
' Created: 01/27/11
' Updated:
' Version: 1.0
' Author(s): Zac
'
' Purpose: This script is used to set Microsoft Office Communicator
' policies and set it to RunOnce
'
' Notes: None.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'**Start Encode**
' The line above exists if there is a desire to encode the script for security reasons.
' To encode the script, download the script encoder via the link below.
' http://www.msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
Option Explicit
Dim wShell, sProgramFiles, oFSO
Set wShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Figure out if this is an x86 or x64 OS
If wShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") = "%ProgramFiles(x86)%" Then
sProgramFiles = wShell.ExpandEnvironmentStrings("%ProgramFiles%")
Else
sProgramFiles = wShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
End If
' Check if Communcator is on the machine. If so, add these registry keys
If oFSO.FileExists(sProgramFiles & "\Microsoft Office Communicator\communicator.exe") Then
' These keys kill the auto start
If RegistryValueExists("HKCU\Software\Microsoft\Windows\CurrentVersion\Run\COMMUNICATOR") Then
wShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\COMMUNICATOR"
End If
wShell.RegWrite "HKCU\Software\Microsoft\Communicator\AutoRunWhenLogonToWindows", 0, "REG_DWORD"
' Communicator HKLM policies
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\AllowUnencryptedFileTransfer", 0, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\CallLogAutoArchivingPolicy", 0, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\DisableOnlineContextualSearch", 1, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\DisableSavingIM", 0, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\EnableSIPHighSecurityMode", 1, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\EnableURL", 1, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\IMAutoArchivingPolicy", 1, "REG_DWORD"
wShell.RegWrite "HKLM\SOFTWARE\Policies\Microsoft\Communicator\TourLaunchMode", 2, "REG_DWORD"
' Communicator HKCU policies
wShell.RegWrite "HKCU\Software\Microsoft\Communicator\AutoOpenMainWindowWhenStartup", 0, "REG_DWORD"
wShell.RegWrite "HKCU\Software\Microsoft\Communicator\FirstTimeUser", 0, "REG_DWORD"
wShell.RegWrite "HKCU\Software\Microsoft\Communicator\TourPlayed", 1, "REG_DWORD"
wShell.RegWrite "HKCU\Software\Policies\Microsoft\Communicator\ServerAddressInternal", "*", "REG_SZ"
wShell.RegWrite "HKCU\Software\Policies\Microsoft\Communicator\ServerAddressExternal", "*", "REG_SZ"
wShell.RegWrite "HKCU\Software\Policies\Microsoft\Communicator\Transport", 4, "REG_DWORD"
wShell.RegWrite "HKCU\Software\Policies\Microsoft\Communicator\ConfigurationMode", 0, "REG_DWORD"
' Fix Live Meeting over MSVPN
wShell.RegWrite "HKCU\Software\Microsoft\Shared\UcClient\Transport", 4, "REG_DWORD"
' Add Communicator to RunOnce key, so that it starts after the desktop loads
wShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\Communicator", """" & sProgramFiles & "\Microsoft Office Communicator\communicator.exe""", "REG_SZ"
End If
Set oFSO = Nothing
Set wShell = Nothing
Wscript.Quit
'************************************
'* Registry Value Exists (Function)
'* Returns a value (true / false)
'************************************
'This function checks to see if a passed registry value exists, and
'returns true if it does
' Stolen from http://www.tek-tips.com/faqs.cfm?fid=5864
'
'Requirements: The registry value you are looking for (RegistryValue)
Function RegistryValueExists (RegistryValue)
'Ensure the last character is NOT a backslash (\) - if it is, we aren't looking for a value
If (Right(RegistryValue, 1) = "\") Then
'It's not a registry value we are looking for
RegistryValueExists = false
Else
'If there isnt the value when we read it, it will return an error, so we need to resume
On Error Resume Next
'Try reading the value
WshShell.RegRead RegistryValue
'Catch the error
Select Case Err
Case 0:
'Error Code 0 = 'success'
RegistryValueExists = true
Case Else
'Any other error code is a failure code
RegistryValueExists = false
End Select
'Turn error reporting back on
On Error Goto 0
End If
End Function
See, this is how it starts. Now you'll have scripts for connecting shared drives, network printers, and everything else before long.