Search 200 workstations and Replace a file, via script or other process?????
Hi, I'm just throwing this one out there for advise. I have around 200 workstations that have a web url on the all users desktop or users favorites and I need to change the web address. I have a modified URL to replace the offending file but how do I get it out there.
I thought maybe there might be a way to script, search c$ for any instances of the file "example.url" and replace with a new file.
I have SCCM 2012, I've modified the software inventory to identify the organisations workstations with the url but its in several locations on many of the pc's, i've created a collection for the job.
Any advise on a method to execute change would be much appreciated
W
-
You may wish to investigate my File Control HTA which can be found on Source Forge. It was built as a QAD means to get configuration files copied to lots of PCs but it morphed into a more general-purpose tool. - anonymous_9363 11 years ago
Answers (3)
Thanks for the advise. What I forgot to mention was that i had a mixture of Windows XP Pro SP3 clients and Windows 7 SP1 clients.
In my origional plan I created an sccm package which simply copied the below script 'replace.cmd' and 'example.url' to the root of the c: drive, I would run the 'replace.cmd' script which searchs the c: drive for example.url and replaces it with the newly copied one on the root. After the process completes i del the 'replace.cmd' and 'example.url' from the root. replace.cmd script looks like this;
_________________________________________________________________
for /F "tokens=*" %%P in ('dir /b /s "example.url"') do copy /Y .\"example.url" "%%P"
del /Q c:\example.url
del /Q c:\fileupdate.cmd
_________________________________________________________________
This package worked fine for XP machines but I found while testing that on Windows7 PC's with our current UAC it prompted me for elevated privileges even with local admin.
So in the end I created a small sccm task sequence with Run Command Line, I added the package. For the command line I ran it as follows
cmd /c replace.cmd example.url
I ticked 'Run the step as the following account' and used my Domain Admin account.
Suppressed task sequence notification and deployed successfully.
Thanks again for the advise, N
Comments:
-
What I've used....
if exist c:\users\%username%\desktop\reporting\issoreportingde.fp7 copy /y issoreportingde.fp7 c:\users\%username%\desktop\reporting\issoreportingde.fp7
Add the file as a dependency and run as logged in user otherwise the variable won't work properly. - rsm11 11 years ago