3 obvious errors;
1 - The 7th line of code should read;
If Not objFSO.FileExists("C:\windows\System32\SystemTray.dll") Then2 - The first line of code in the 'copysystemtrayfile' sub should read;
objFSO.CopyFile "\\fn.local\NETLOGON\bin\SystemTray.dll", "C:\windows\System32\"3 - The 'Dim filesys' is not required
You might also want to use a system variable to determine the location of the System32 folder rather than hard coding it as 'C:\Windows\System32'.
This whole script would be easier to write in AutoIt;
const $SysTrayDllSource = "\\fn.local\netlogon\bin\systemtray.dll"Of course if you were to use AutoIt scripts, you would not need the SystemTray dll in the first place as AutoIt can already do that!!
if not FileExists(@SystemDir & "\SystemTray.dll) then
FileCopy($SysTraySource, @SystemDir, True)
RunWait("regsvr32.exe " & @SystemDir & "\systemtray.dll /s", @SystemDir)