Halp Any Groping Policy experts here?

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.

It already does

ECHO %DATE% %TIME% Communicator found at %ProgFiles%\Microsoft Office Communicator\communicator.exe >> c:\logon.log

And the path is correct.

edit: Glad to see that I wasn't doing something glaringly stupid.
 
it might not start if explorer isn't started already.

could other policies be conflicting? not running as administrator or something? virus scanner or something blocking exe's from launching?

could also try like
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshScriptExec = WshShell.Exec("%WINDIR%\System32\Calc.exe")


edit: found this (copy pasted)
When you enable the Run logon scripts synchronously policy in Windows XP,
the desktop loads before the logon script finishes?

Windows XP enables a logon performance enhancement by default, which causes
your computer to not wait for Group Policy processing before initializing
the user environment.

To work around this feature, enable the Always wait for the network at
computer startup and logon Group Policy:

1. Open the appropriate GPO.

2. Expand Computer Configuration / Administrative Templates / System / Logon

3. Double-click Always wait for the network at computer startup and logon.

4. Enable the policy and press OK.

----

dunno if that'll help or not.
 
also, just to humor me, try:

cd "%ProgramFiles%\Microsoft Office Communicator\"
START "" "%ProgramFiles%\Microsoft Office Communicator\Communicator.exe"

or

cd "%ProgramFiles%\Microsoft Office Communicator\"
START "" "Communicator.exe"

for some reason startup scripts can be some quirky shit sometimes.
 
I think you hit the nail on the head with explorer not being loaded. I'll test it this afternoon. If thats the case, I'll have to make a looping vbscript to wait for explorer to launch. Fucking great. :rolleyes:
 
Try wsh.run(whatever.exe /passive /quiet /norestart,, true)

needing to wait for certain services to start before launching an app in a logon script isnt uncommon, so there are ways to do it.
 
maybe have the logon script add a script to the start menu, and the start menu script can load communicator then delete itself?

its not elegant, but we do something similar for network printers (though the start menu script just deletes some log file that gets put on the desktop for some reason).
 
I'm hoping to get around the requirement altogether by saying it can't be done now. :lol:

However, I could do that. Actually adding it to the RunOnce registry key might work as well, and I wouldn't need the delete.
 
Yay. RunOnce runs after the desktop has loaded and has resolved the issue.

Code:
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "Communicator" /t REG_SZ /d """"%ProgFiles%\Microsoft Office Communicator\communicator.exe"""" /f
 
Okay, so if you care, here is my final script. I switched to vbscript to avoid the CMD window. I know I could have just hidden it, but whatever.

Code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' 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
 
Last edited: