tosca925 Posted March 22, 2006 Posted March 22, 2006 I am useless at scripts but need someone to help me out. I need a script to run in a GPO on computer start up. I need it to check for a file in systems 32, ie, c:\windows\system32\file.dll. If it exists i need the script to rename the file to oldfile.dll. Then the script needs to copy a new file.dll to the same location from a folder on the server. Could anyone please help me.
Shiny_Guru Posted March 22, 2006 Posted March 22, 2006 Try This ::____________Start Script______________________ :: check if oldfile.dll exists, if so script has already run if exist "%windir%\system32\oldfile.dll" goto :EOF :: if oldfile.dll does not exist and file.dll does exist then we need to act if exist "%windir%\system32\file.dll" rename "%windir%\system32\file.dll" oldfile.dll :: now copy the new file from the server copy "\\server\share\file.dll" "%windir%\system32\file.dll" @echo Job Completed ::____________End Script______________________ beware of the word wrap, the orphaned oldfile.dll on line 6 belongs on the end of line 5
Shiny_Guru Posted March 22, 2006 Posted March 22, 2006 Me again, there are lots of word wrap issues in that code, copy and paste seems to make it OK but just in case I have attached the file to this post. You will need to change the extention to cmd - but you knew that anyway (I just can't upload .cmd files)dll_copy.txt
Shiny_Guru Posted March 23, 2006 Posted March 23, 2006 Only partly true, if it is a system dll then I agree, if it is a dll put there by a 3rd party app then probably not - I have not seen many of them go to the bother of protecting their dlls. However our school is mostly w2k and the age of most of the software reflects that environment so I may well be wrong about this specific case. If the file is under the protection of sfp then I agree that the job becomes a little more problematic than the would be addressed by the simple script that I offered but it does what was asked for (I think) and if more is actually needed we can look at that after Tosca has tried it in his environment.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now