I have to copy a .cfg file to a specific location under the program files directory on my workplace servers.
Unfortunately this is not only OS dependent (2003/2008/2012) but also has to determine if the OS is 32 or 64 bit and copy to the ‘Program Files (x86)’ directory path if applicable.
My plan is to have the three different version of the the file on one server and have the script copy the relevant one to the right location (overwriting the existing file), but I’ve had pretty much zero exposure to vbscripting so I’m struggling big time!
WMI is probably the best approach. Assuming that the script will be run on each target host you could do something like this: