machine\startup VBscript objFSO.CopyFile srvfileName, w7Path, true

On a windwos 2008 domain I have a GPO that executes a vbscript from the \\servername\sysvol\domain\policies\{policy}\machine\script\startup so it will run at system level privileges.

The scripts executes until it gets to objFSO.CopyFile srvfileName, w7Path, false      then appears to just stop an never completes the script.

I have turned off uac and the workstation has local admin rights and still the same result.

The script will run if ran manually after logon to the workstation.

This script checks file date and size and copy's the updated file.   It use to work.
file.txt
LVL 1
Joel ArmstrongNetwork AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
cleaned up your code somewhat and added errorlevels
Dim objFSO
Dim pcfilename
Dim srvfilename
Dim xpPath 
Dim w7Path
Dim Path
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWS = WScript.CreateObject ("WScript.shell")
set objNetwork = WScript.CreateObject ("WScript.Network")

pcfilesize=0
srvfilesize=0
Return=0
msgreturn=0
mapi32size=0
xpPath = "c:\program files\classmate\classmate.exe"
w7Path = "c:\program files (x86)\classmate\classmate.exe"
srvfilename = "\\xyz-server\classmate\classmate\client\classmate.exe"

'*** setup message ruturn values ***
timeout=-1
ok=1
cancel=2
abort=3
retry=4
ignore=5
yes=6
no=7
'************************************
'msgreturn=objws.popup ("original Stinger "& stingersize & vbCrLf & "Apps Stinger " & oldstingersize & vbCrLf & "Files Match. Overwrite?",30, "Message Box",4+32)
'=======================


 '===============================================================
 ' Test for existence of classmate.exe and copy if exists
 '===============================================================
if (objFSO.FileExists(srvfilename)) Then
	'WScript.Echo(" windows 7 path === " & w7Path)
	'WScript.Echo("xpPath === "& xpPath)
	if (objFSO.FileExists(w7Path)) Then
		'WScript.Echo("WOW you have windows 7 " & w7Path)
		WScript.Echo("*** Updating ClassMate.exe on Windows 7 ***")
		update(w7Path)
	ElseIf (objFSO.FileExists(xpPath)) Then
			'WScript.Echo("You have XP "& xpPath)
			WScript.Echo("*** Updating ClassMate.exe on Windows XP ***")
			update(xpPath)
	Else
		WScript.Echo("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"& vbCrLf &"!!!!!!!!!!!!!!!!!!   ERROR   !!!!!!!!!!!!!!!!!"& vbCrLf &"! ClassMate.exe NOT FOUND at Path "&w7path & vbCrLf &"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
		quit_release(2)
	End If
Else
	WScript.Echo("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"& vbCrLf &"!!!!!!!!!!!!! File ERROR  !!!!!!!!!!!!!!!!"& vbCrLf &"!! ClassMate.exe NOT FOUND at Path "&srvfilename &"!!"& vbCrLf &"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
End If

quit_release(1)

'******************************** Functions *****************************************************************

Function quit_release(error)
	'===============================================================
	' Release FileSystemObject
	'===============================================================
	WScript.Echo("************* THE END *****************")
	Set objFSO = Nothing
	set objws = nothing
	set objNetwork = nothing
	Wscript.Quit(error)
end Function

Function update(path)
	pcfilename = Path
	Set f = objFSO.GetFile(srvfileName)
	srvfilesize=f.size
	srvfiledate=f.DateLastModified
	
	Set f = objFSO.GetFile(pcfileName)
	pcfilesize=f.size
	pcfiledate=f.DateLastModified
	orgpcfiledate=pcfiledate
	orgpcfilesize=pcfilesize
	WScript.Echo("*****************************************"& vbCrLf &"Server File Size - "& srvfilesize & vbCrLf &"Server File Date - "& srvfiledate & vbCrLf &"*****************************************"& vbCrLf &"PC filesize - "& pcfilesize & vbCrLf & "PC file Date - "& pcfiledate &vbCRLf&"*****************************************")

	If (pcfiledate <> srvfiledate OR pcfilesize <> srvfilesize) then
			objFSO.CopyFile srvfileName, w7Path, true
			Set f = objFSO.GetFile(pcfileName)
			Set f = objFSO.GetFile(pcfileName)
			pcfilesize=f.size
			pcfiledate=f.DateLastModified
			WScript.Echo("*****************************************"& vbCrLf &"********* File update complete **********"& vbCrLf&"*****************************************"& vbCrLf &"Server File Size - "& srvfilesize & vbCrLf &"Server File Date - "& srvfiledate & vbCrLf &"*****************************************"& vbCrLf &"PC filesize - "& pcfilesize & vbCrLf & "PC file Date - "& pcfiledate &vbCRLf&"*****************************************")
			WScript.Echo("*****************************************"& vbCrLf &"********* Orignal PC file info **********"& vbCrLf&"*****************************************"& vbCrLf &"org pc File Size - "& orgpcfilesize & vbCrLf &"Org pc File Date - "& orgpcfiledate & vbCrLf &"*****************************************")
		ElseIf (pcfiledate = srvfiledate And srvfilesize = pcfilesize) then
			WScript.Echo("*****************************************"& vbCrLf &"***** File appears to be up to date *****"& vbCrLf&"*****************************************"& vbCrLf &"Server File Size - "& srvfilesize & vbCrLf &"Server File Date - "& srvfiledate & vbCrLf &"*****************************************"& vbCrLf &"PC filesize - "& pcfilesize & vbCrLf & "PC file Date - "& pcfiledate &vbCRLf&"*****************************************")
		End If
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joel ArmstrongNetwork AdministratorAuthor Commented:
Thanks for looking at the code, however, I think I finally found the real issue.  The folder on one of the server did not have the SYSTEM listed under the security tab.  So, I assume since the script when executed from \\server\SYSVOL\Domain.Something\Policies\{904A92FE-11D6-4854-AE9D-6A30EA6E9AA3}\Machine\Scripts\Startup supposedly runs with SYSTEM level privileges could not access the file because of permissions.   I added the SYSTEM account back to the folder and everything went back to working.  

I did look at the code you modified and will probably clean it up with your suggestions especially since we no longer use windows XP.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.