Avatar of cahillj
cahillj
Flag for United States of America asked on

associate file types for everyone in terminal servers

How do I associate Tif file to Microsoft Office Document Imaging?  I need to associate for everyone that logs into this server...   When I log in as administrator and associate it, it only does it for me...  is there reg hack or something?
Windows Server 2003Microsoft Legacy OS

Avatar of undefined
Last Comment
Serge Fournier

8/22/2022 - Mon
Serge Fournier

this is an example where i associate iso with daemon tools in logon script

if you have a logon script in your domain, then it will also run for every user on terminal server

to access thoses registry keys, either your script must run BEFORE use log, with machine right (a gpo can do that)
or your users must have some permissions to do so (by default they do not, if not in local admin group)

you can also put the script in all users startup if it's not in a domain

obviously, this is not a top answer :P

just copy past from my work, so change what you want


Set objshe    = WScript.CreateObject("WScript.Shell")
set objEnv    = objshe.Environment("PROCESS")
Set objFSO    = wscript.CreateObject("Scripting.FileSystemObject")
Set objNet    = CreateObject("WScript.Network") 
set objsheapp = wscript.CreateObject("Shell.Application")
Set objaut    = WScript.CreateObject("AutoItX.Control")
Set objReg    = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
 
      f=prodir32 & "\daemon tools"
      e="\daemon.exe"
      if objFSO.fileEXISTS(f & e) then
         a =f & e
         d = f
      end if
 
         b="iso"
         c=runwit(a &" -mount 0, ""%l""",b,"imagecd" & b)
 
'======= register a certain extension to run with a certain program
 
function runwit(runwitprog, runwitext, runwitnam)
 
   runwita="HKEY_CLASSES_ROOT\."& runwitext &"\"
   runwitb=runwitnam
   runwitc="REG_SZ"
   runwitd=regwri(runwita,runwitb,runwitc)
   
   runwita="HKEY_CLASSES_ROOT\"& runwitnam &"\"
   runwitb=runwitnam
   runwitc="REG_SZ"
   runwitd=regwri(runwita,runwitb,runwitc)
   
   runwita="HKEY_CLASSES_ROOT\"& runwitnam &"\shell\open\command\"
   runwitb=runwitprog
   runwitc="REG_SZ"
   runwitd=regwri(runwita,runwitb,runwitc)
 
end function
'====== write a value in registry, trap error
function regwri(regkey, value, type01)
   if type01<>"" then
      on error resume next
      objshe.RegWrite regkey,value,type01
   else
      objshe.RegWrite regkey,""
   end if
   if err.number<>0 then
      'msgfin = msgfin & "`n" & regkey & "`n"
      toterrcop = toterrcop + 1
      msgfin03 = msgfin03 & vbcrlf & "error - register base not written: " & vbcrlf & regkey & vbcrlf & err.description & vbcrlf
      if usenam = debugname then
         msgbox("cannot write key" & vbcrlf & regkey & vbcrlf & value)
      end if
   end if
end function

Open in new window

Brian Pringle

Just as a start, there is a command in Windows called "assoc".  Go to a command line and issue the following command to see the format.

assoc /?
Serge Fournier

still forgot:

remove this line, it's a autoitx object you dont have on our computers (need a dll registred)
Set objaut    = WScript.CreateObject("AutoItX.Control")
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Serge Fournier

i also forgot

this is a VBS file you must save it as
cahillj

ASKER
well i was actually looking for something that has to do with registry... I don't really want to have this script running all the time for everyone...
ASKER CERTIFIED SOLUTION
cahillj

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Serge Fournier

you can see in my script where the file association are in register base:
HKEY_CLASSES_ROOT

so change the path and file name for the program you want tif to be associated with
path to the file .exe:
   f=prodir32 & "\daemon tools"
   e="\daemon.exe"

save as VBS
execute
It will write it in a section in registry that is used for ALL users (pretty sure about that)

i was suggesting the logon technique just to configures all computer in a network
but for a terminal server it's not necessary



⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.