Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GPO for a network share icon on desktop...

Status
Not open for further replies.

peteygnyc

IS-IT--Management
May 25, 2005
30
US
My problem is that I need to place a shared network drive folder on everyone's (all domain users) desktop. I need this by 11am tomorrow. HELP! I am desperate.
This drive share can be administered through AD from what I understand. Will a login script do this? Or, do I need a GPO for it? If a login script will work, what should it look like? (I have never done scripting before).

The path to the share will be \\MD-server\shared
Please tell me how to make this policy.
Any help is greatly appreciated!!!
Thanks!
-Pete
 
You could try using the User Configuration>Administrative Templates>Desktop>Active Desktop>Add Desktop Items object within GPO...
 
Ok I tried it at home, and it worked (sorta). It attempted to create the icon, but since the drive share did not exist in my home enviornment, I got an error. So, we know that works.
I came in this morning, and tried it on a test server here. One that is completly the same as the live box but on a different network completely (test envior.) and it did not work. Any ideas?
-Pete
 
Try this if you want to script it.

If Exist "%ALLUSERSPROFILE%\Desktop\shortcut" GoTo END

copy "\\server\share\shortcut" "%ALLUSERSPROFILE%\Desktop\"

:END
 
What exactly is the shortcut? The path to the share on the server is :

\\md-server\shared

so how exactly do I put this in there? What is the "shortcut" variable?

-P
 
Ok I got it working but unfortunately, the icon to the share is not showing, but the contents within that share ARE. How do I get it to JUST show the folder (so that the users can open it)???
-Pete
 
You need to created a shortcut to the drive and save it to your desktop. That is now a file just like a word document. So use the script that bkuepers made and go from there.

 
Create a shortcut file .ink. That goes to that UNC path. "shortcut" would actually be that shortcut file you created. Throw it out in your netlogon share. Copy command would then be.......

copy "\\server\netlogon\shortcut.ink" "%ALLUSERSPROFILE%\Desktop\"

That clear things up?
 
Full script would be......

If Exist "%ALLUSERSPROFILE%\Desktop\shortcut.ink" GoTo END

copy "\\server\netlogon\shortcut.ink" "%ALLUSERSPROFILE%\Desktop\"

:END
 
I would have to offer some other advice here as I am not a fan of copying any files during login.

I think it is a lot better to dynamically create the shortcut using vbscript. The process is very easy and painless.

Here is a sample that will create a shortcut to the Windows\System32 directory and call it Windows Sys32.

Code:
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
strDsk = WshShell.SpecialFolders("Desktop")
[green]'Edit the name below for your shortcut.
'Note only replace the text Windows Sys32[/green]
strshortcut = strDsk & "\Windows Sys32.lnk"
If Not fso.FileExists(strshortcut) Then
	SET oUrlLink = WshShell.CreateShortcut(strshortcut)
[green]'Edit the path below for your shortcut target.  
        'Note replace everything after the = sign, enclose the path in quotes.[/green]
	oUrlLink.TargetPath = Windir & "\System32\"
	oUrlLink.Save
End If

Save this code as a VBS extension and add to a GPO. For comprehensive help on login scripts, please refer to my FAQ faq329-5798.

This was an interesting question, I will be adding it to my FAQ. Thanks for posting it.

I hope you find this post helpful.

Regards,

Mark
 
FAQ has been updated with this. You may prefer the sample code I added there as it shows pointing to a network share instead of a local folder.

I hope you find this post helpful.

Regards,

Mark
 
Hey Mark,
I am not real comfortable pushing a GPO on a live production box which is the reason why I was leaning towards a login script (which I still cannot get to work right). The reason I want to use a login script is because I could just create the second script and am able to test this without putting it on a live box. How would one go about putting a vbscript on a GPO? Is there ANY way to test this (since it is a GPO) without pushing this out to everyone? I have no test enviorment.
Does anyone here know where to get the icon for a network share? I tried to find the one windows uses but it seems to be a .dll file. Any advice given to me should be like trying to instruct a 3 year old, since I have never done anything like this before. (Don't ask how this suddenly fell into my lap).
Thanks again guys!
-Pete
 
peteygnyc,

Did you look at the FAQ I referenced? It shows how to put a script in a GPO.

The beauty of this is that it is a script, so you can simply double click it to test. When you are comfortable with that, create the GPO as outlined in the FAQ. Until you add the script, the GPO will have ZERO affect on ANY users.

After applying the script to the GPO, if you would like to test the GPO on a limited set of users for pilot you can do that too. Just right click the GPO name in the Editing Console and choose properties. This will let you select the security of the GPO. Uncheck the box for Authenticated Users next to apply. Explicitly add in your test users and check apply for them.

GPOs are nothing to be fearful of. Just don't mess with the "default" ones and always add a DENY to administrator and all will be well. I suggest adding the deny for admin because if you ever do restrict things within the GPO you just want to be sure you don't lock admin out of stuff.

I hope you find this post helpful.

Regards,

Mark
 
you can setup a test OU, add one user to it...
create and link new gpo to this new OU.
then in login scripts in the user part of the GPO, use mark's script to create the login.

that way, you're testing on ONE person.....

Aftertaf
________
Regain control of your PC, at
 
Ok well I am not exactly sure how to put this path in correctly here...
the server is called MD-Server
the shared folder is called Shared
I'm imagining it is supposed to look like this:
\\md-server\shared

right?
-p
 
AWESOME...I got it. Thanks so much guys. I tested it and it works flawlessly...you guys seriously ROCK...
thanks again..
-P
 
Out of curiosity, which route did you go? Copy or script build?

I hope you find this post helpful.

Regards,

Mark
 
Mark,

I copied your script. Took me a few mins to modify it so that it did what I wanted it to do, but the end result worked like a champ.
Thanks again to you and everyone else who helped as well.

Regards,
Pete
 
Uh oh...I followed your EXACT instructions in the FAQ's page and now it is not working for my domain. It worked for a test account I had made but once I applied it to the domain, it doesn't create the icon. If I run it from sysvol dir, it creates the icon, so I KNOW the script works....help!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top