/build/static/layout/Breadcrumb_cap_w.png

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

 


1 Comment   [ + ] Show comment
  • 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)

Posted by: EVEEN 11 years ago
Green Belt
2

You can start with the delete script from http://www.itninja.com/question/vbscript-to-search-for-and-delete-file to get rid of the old.url, run this from an msi as custom action and create the new url in a later action. 


Comments:
Posted by: vjaneczko 11 years ago
9th Degree Black Belt
0

It'd be easier to use your login script and run two command lines, one for each location to check.

"If exist 'oldX' xcopy 'newX' 'Location' /v/y"

Posted by: sonik777 11 years ago
Orange Senior Belt
0

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
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ