?
Solved

HELP!!!  Need to add a web link to the Favorites of all my lab PCs

Posted on 2011-04-19
10
Medium Priority
?
720 Views
Last Modified: 2012-05-11
Hi, I need to create a script that will add the following link to all my student lab PCs favorites for IE on our XP Pro systems.

javascript:d=document;i='AddToRWScript';try{RWAddToRW1();}catch(e){s=d.createElement('script');s.type='text/javascript';s.src='http://www.refworks.com/refgrabit/rgibookmark.aspx?rgiid=faea0919-8ade-4097-8d89-bbc7108c45c8';s.id=i;d.getElementsByTagName('head')[0].appendChild(s);}void(0);

I cannot just add this to the GP because as you can see it is not a typical URL address.

I don't care how I accomplish it just as long as it is simple and quick, GP, VB script, PowerShell, etc.

I do have PowerShell installed on all the XP systems in the labs.  So, I guess PS could be used?

Any suggestions or script code will be greatly appreciated.

Thanks in advance.
0
Comment
Question by:rsnellman
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 35429713
Hi, rsnellman.

You can create a URL shortcut (example attached) and then deploy it to all computers via a logon script or, possibly, via group policy.  EE doesn't allow uploading a file with a .url extension, so I changed the extension to .txt.  Change it back to .url.
rsnellman.txt
0
 
LVL 17

Expert Comment

by:Tony Massa
ID: 35429820
Here's a script that, if run by the user, will add the favorite for them.  You can copy the script to the ALL USERS STARTUP folder
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")

strFile = "MyFavorite.url"

Set WshShell = CreateObject("WScript.Shell")
strFavorites = WshShell.SpecialFolders("Favorites")

strURLPath = strFavorites & "\" & strFile

If objFSO.FileExists(strURLPath) Then
	'Favorite already exists for this user...quit
	WScript.Quit(0)
End If

strURL = "javascript:d=document;i='AddToRWScript';try{RWAddToRW1()" & _
  ";}catch(e){s=d.createElement('script');s.type='text/javascript';s.src=" & _
  "'http://www.refworks.com/refgrabit/rgibookmark.aspx?rgiid=faea0919-8ade-4097-8d89-bbc7108c45c8'" & _
  ";s.id=i;d.getElementsByTagName('head')[0].appendChild(s);}void(0);"

Set objShortcutUrl = WshShell.CreateShortcut(strURLPath)
objShortcutUrl.TargetPath = strURL
objShortcutUrl.Save

Open in new window

0
 

Author Comment

by:rsnellman
ID: 35429899
Thanks for the quick responses.  I like the different approaches.  However, how can I get it on the systems remotely?  LIke tmassa99, how could I get this on the systems remotely via a startup script or logon script via GP?  Or BlueDevilFan, how can I get this URL shortcut onto the lab PCs?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Assisted Solution

by:koiboi86
koiboi86 earned 1000 total points
ID: 35431438
a simple thing would be to just save the 'favorite' on a network location. create a simple batch file such as

xcopy 'file location' 'to user\favorites'

exit

and setup the batch to be a start up script on your group policy.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35431613
koiboi86 hit the nail on the head.  That's exactly how I'd copy the file.  
0
 
LVL 17

Expert Comment

by:Tony Massa
ID: 35432344
Here's a script that if run as an admin can copy a file from one location to a list of PCs "STARTUP" folder.  Just create a file called LABPCs.txt and place it in the same location as the script when you run it.

Just edit the line with "strSourceFile" with the path of the script I wrote above.
Certainly, just try one computer in the list first.

 
On Error Resume Next
ComputerList = "LabPCs.txt"

strSourceFile = "\\server\share\filename.vbs"

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(ComputerList, ForReading, True)

Do While f.AtEndOfLine <> True
  strComputer = f.ReadLine
  strDestination = "\\" & strComputer & "\Documents and Settings\All Users\Start Menu\Programs\Startup\"
  fso.CopyFile strSourceFile, strDestination
Loop

Open in new window

0
 

Author Comment

by:rsnellman
ID: 35441791
Thanks to all for all the help.  I have just one more question about this process.  Will this xcopy overwrite the existing link on the lab systems?  Reason I ask is the organization of the link has changed the link and that is why I need to push this new link out to correct that.

Thanks.
0
 

Author Comment

by:rsnellman
ID: 35444250
OK, I guess I am having permission issues trying to copy the .url provided by BlueDevilFan.

I would like to add the .url to either the "All Users\Favorites" or better yet copy over the existing .url in the "Default User\Favorties".

So, I created a bat file based off of koiboi86's suggestion:
--------------------------------------------------------------------------------------------
xcopy \\server\folder\file to C:\Documents and Settings\All Users\Favorites

exit
---------------------------------------------------------------------------------------------
And I tried this code too:
--------------------------------------------------------------------------------------------
xcopy \\server\folder\file to C:\Documents and Settings\Default User\Favorites

exit
---------------------------------------------------------------------------------------------

I tried these codes in the Computer Configuration\Startup Scripts & User Configuration\Logon Scripts.

That should have worked, right?  Or am I missing something in this code?  Remember I am no scripter.

0
 
LVL 17

Expert Comment

by:Tony Massa
ID: 35444298
My File copy script should have included "C$\"...

On Error Resume Next
ComputerList = "LabPCs.txt"

strSourceFile = "\\server\share\filename.vbs"

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(ComputerList, ForReading, True)

Do While f.AtEndOfLine <> True
  strComputer = f.ReadLine
  strDestination = "\\" & strComputer & "\C$\Documents and Settings\All Users\Start Menu\Programs\Startup\"
  fso.CopyFile strSourceFile, strDestination
Loop

Open in new window

0
 
LVL 17

Expert Comment

by:Tony Massa
ID: 35444322
To always create a new URL, use this script...my script only created a new URL.
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")

strFile = "MyFavorite.url"

Set WshShell = CreateObject("WScript.Shell")
strFavorites = WshShell.SpecialFolders("Favorites")

strURLPath = strFavorites & "\" & strFile

If objFSO.FileExists(strURLPath) Then
  objFSO.DeleteFile(strURLPath), TRUE
End If

strURL = "javascript:d=document;i='AddToRWScript';try{RWAddToRW1()" & _
  ";}catch(e){s=d.createElement('script');s.type='text/javascript';s.src=" & _
  "'http://www.refworks.com/refgrabit/rgibookmark.aspx?rgiid=faea0919-8ade-4097-8d89-bbc7108c45c8'" & _
  ";s.id=i;d.getElementsByTagName('head')[0].appendChild(s);}void(0);"

Set objShortcutUrl = WshShell.CreateShortcut(strURLPath)
objShortcutUrl.TargetPath = strURL
objShortcutUrl.Save

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question