<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I Create a Shortcut in My Network Places?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/09/how-can-i-create-a-shortcut-in-my-network-places.aspx</link><description>Hey, Scripting Guy! How can I create a shortcut in My Network Places? -- KP 
 Hey, KP. You’ll have to excuse us if we sound a little out of breath; we’ve been running around like crazy looking for a complicated and highly-technical solution to this problem</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Create a Shortcut in My Network Places?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/09/how-can-i-create-a-shortcut-in-my-network-places.aspx#3374292</link><pubDate>Fri, 10 Dec 2010 10:08:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3374292</guid><dc:creator>Ben R</dc:creator><description>&lt;p&gt;How to I remove these shortcuts within a script?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3374292" width="1" height="1"&gt;</description></item><item><title>re: How Can I Create a Shortcut in My Network Places?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/09/how-can-i-create-a-shortcut-in-my-network-places.aspx#3349545</link><pubDate>Wed, 11 Aug 2010 12:36:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3349545</guid><dc:creator>TechnicLee</dc:creator><description>&lt;p&gt;Thank you, JRV, for describing the proper way to do this.&lt;/p&gt;
&lt;p&gt;Here is a VBScript version of JRV&amp;#39;s batch file. &amp;nbsp;I&amp;#39;ve tested it on Windows XP and it works fine.&lt;/p&gt;
&lt;p&gt;Sub AddMyNetworkPlace(strPath)&lt;/p&gt;
&lt;p&gt;	Dim objFSO, objShell, objMNP, objFolder, objFile, objLNK, strName&lt;/p&gt;
&lt;p&gt;	strName = Mid(strpath,InStrRev(strpath,&amp;quot;\&amp;quot;) +1)&lt;/p&gt;
&lt;p&gt;	Set objFSO = CreateObject(&amp;quot;Scripting.FileSystemobject&amp;quot;)&lt;/p&gt;
&lt;p&gt;	Set objShell = CreateObject(&amp;quot;WScript.Shell&amp;quot;)&lt;/p&gt;
&lt;p&gt;	Set objMNP = objFSO.GetFolder(objShell.SpecialFolders(&amp;quot;Nethood&amp;quot;))&lt;/p&gt;
&lt;p&gt;	Set objFolder = objMNP.SubFolders.Add(strName)&lt;/p&gt;
&lt;p&gt;	objFolder.Attributes = 1&lt;/p&gt;
&lt;p&gt;	Set objFile = objFSO.CreateTextFile(objFolder.Path &amp;amp; &amp;quot;\desktop.ini&amp;quot;)&lt;/p&gt;
&lt;p&gt;	With objFile&lt;/p&gt;
&lt;p&gt;		.WriteLine &amp;quot;[.ShellClassInfo]&amp;quot;&lt;/p&gt;
&lt;p&gt;		.WriteLine &amp;quot;CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}&amp;quot;&lt;/p&gt;
&lt;p&gt;		.WriteLine &amp;quot;Flags=2&amp;quot;&lt;/p&gt;
&lt;p&gt;		.Close&lt;/p&gt;
&lt;p&gt;	End With&lt;/p&gt;
&lt;p&gt;	Set objFile = objFSO.GetFile(objFolder.Path &amp;amp; &amp;quot;\desktop.ini&amp;quot;)&lt;/p&gt;
&lt;p&gt;	objFile.Attributes = 6&lt;/p&gt;
&lt;p&gt;	Set objLNK = objShell.CreateShortcut(objFolder.Path &amp;amp; &amp;quot;\target.lnk&amp;quot;)&lt;/p&gt;
&lt;p&gt;	With objLNK&lt;/p&gt;
&lt;p&gt;		.TargetPath = strPath&lt;/p&gt;
&lt;p&gt;		.Save&lt;/p&gt;
&lt;p&gt;	End With&lt;/p&gt;
&lt;p&gt;	Set objLNK = Nothing&lt;/p&gt;
&lt;p&gt;	Set objFile = Nothing&lt;/p&gt;
&lt;p&gt;	Set objFolder = Nothing&lt;/p&gt;
&lt;p&gt;	Set objMNP = Nothing&lt;/p&gt;
&lt;p&gt;	Set objShell = Nothing&lt;/p&gt;
&lt;p&gt;	Set objFSO = Nothing&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3349545" width="1" height="1"&gt;</description></item><item><title>re: How Can I Create a Shortcut in My Network Places?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/09/how-can-i-create-a-shortcut-in-my-network-places.aspx#3344516</link><pubDate>Thu, 15 Jul 2010 20:06:52 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3344516</guid><dc:creator>JRV</dc:creator><description>&lt;p&gt;A &amp;quot;Network Place&amp;quot; is NOT a shortcut in the NetHood folder! &amp;nbsp;There aren&amp;#39;t a lot of people in the world who know this, so we probably need to address that, first. &amp;nbsp;A &amp;quot;Network Place&amp;quot; is a folder on a remote machine that is integrated into the local Windows namespace, much like a symbolic link. &amp;nbsp;It&amp;#39;s called a &amp;quot;Folder Shortcut&amp;quot;, though admittedly that name doesn&amp;#39;t clarify much.&lt;/p&gt;
&lt;p&gt;Run the VB script. &amp;nbsp;Note the icon it creates is different from the rest. &amp;nbsp;There&amp;#39;s a reason for that. &amp;nbsp;Now open the Folder (treeview) pane in Explorer and expand the My Network Places branch. &amp;nbsp;All other Places (created automatically or via Network Place wizard) are nodes on the My Network Places branch, and can be expanded to reveal their subfolders. &amp;nbsp;But the shortcut created by the script does NOT appear in the My Network Places node because it is only a Shortcut...it is NOT incorporated into Windows&amp;#39; namespace any more than any other shortcut.&lt;/p&gt;
&lt;p&gt;So this is not a script for creating a Folder Shortcut...it&amp;#39;s a script for creating an ordinary Shortcut in a folder.&lt;/p&gt;
&lt;p&gt;To see what a Network Place REALLY looks like, open a CMD window, CD to the NetHood folder, and type ATTRIB -R [networkplacename]. &amp;nbsp;You&amp;#39;ll see it&amp;#39;s really a &amp;quot;normal&amp;quot; folder containing a normal shortcut named TARGET.LNK, and a DESKTOP.INI file. &amp;nbsp;When the read-only flag is raised, Windows inserts the target of the shortcut into the Windows namespace under its parent, in this case My Network Places.&lt;/p&gt;
&lt;p&gt;It can appear elsewhere...the Desktop, drive C:, in %TEMP%, wherever you put the Folder Shortcut is where Windows will splice it in to the namespace.&lt;/p&gt;
&lt;p&gt;(BTW, Windows also creates a Folder Shortcut if if you drag a Folder and drop it on the Start menu.)&lt;/p&gt;
&lt;p&gt;CAUTION: It&amp;#39;s critical that you don&amp;#39;t accidentally create a &amp;quot;circular&amp;quot; namespace with this technique. &amp;nbsp;It&amp;#39;s very easy to do by mistake. &amp;nbsp;Explorer will hang very quickly as you browse it. &amp;nbsp;For example, if you have a Folder Shortcut on your Desktop that points to \\SomeServer\SomeShare, and in \\SomeServer\SomeShare you have another that points to your My Documents folder, you have created a circular namespace. &amp;nbsp;So don&amp;#39;t!&lt;/p&gt;
&lt;p&gt;I script Folder Shortcut creation with a batch file that copies the (non-read-only) folder, desktop.ini and target.lnk to the destination (in my case, the All Users Desktop) and then uses ATTRIB to set the read-only bit.&lt;/p&gt;
&lt;p&gt;IF EXIST &amp;quot;%ALLUSERSPROFILE%\Desktop\MyNetPlace&amp;quot; GOTO END&lt;/p&gt;
&lt;p&gt;xcopy %0\..\&amp;quot;MyNetPlace&amp;quot; &amp;quot;%ALLUSERSPROFILE%\Desktop\MyNetPlace&amp;quot; /I /S /Y&lt;/p&gt;
&lt;p&gt;Attrib +R &amp;quot;%ALLUSERSPROFILE%\Desktop\MyNetPlace&amp;quot;&lt;/p&gt;
&lt;p&gt;:END&lt;/p&gt;
&lt;p&gt;Contents of the folder are the target.lnk as described above, and the desktop.ini which follows:&lt;/p&gt;
&lt;p&gt;[.ShellClassInfo]&lt;/p&gt;
&lt;p&gt;CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}&lt;/p&gt;
&lt;p&gt;Flags=2&lt;/p&gt;
&lt;p&gt;Desktop.ini&amp;#39;s are normally super-hidden files (ATTRIB +S +H), but if this one has normal attributes it doesn&amp;#39;t hurt anything. &amp;nbsp;The read-only attribute of its parent folder is all that matters.&lt;/p&gt;
&lt;p&gt;If you use this batch file, it will work correctly if the Folder Shortcut does not already exist. &amp;nbsp;If it already exists, however, and you use the script hoping to change it to point to some other target (by, for example, replacing the first line with RD /S /Q), the new Folder Shortcut won&amp;#39;t work correctly. &amp;nbsp;When you browse the Network Place, the address in the Address Bar is the folder that contains the Folder Shortcut, not the Target, although it does display the target&amp;#39;s contents. &amp;nbsp;So far, only way I&amp;#39;ve found to change the folder shortcut programatically is to delete it, reboot, then create the new one. &amp;nbsp;True for Win XP SP3, anyway.&lt;/p&gt;
&lt;p&gt;Came here hoping for a better way, but that was not to be. &amp;nbsp;But at least you now have a down-and-dirty way to create a true Folder Shortcut.&lt;/p&gt;
&lt;p&gt;BTW, the technique works in Windows 2000 through Vista/WS2008, but not Win7/WS2008R2. &amp;nbsp;The Folder Shortcut is created, but does NOT join the Windows namespace. &amp;nbsp;Only way I&amp;#39;ve found to approximate this in Win 6.1 RTM is to use Symbolic Links, which is unfortunate because their paths are relative to the containing folder instead of the remote share. &amp;nbsp;Hoping it&amp;#39;s a bug that will be fixed in 6.1 SP1, and that it&amp;#39;s not &amp;quot;by design&amp;quot;.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3344516" width="1" height="1"&gt;</description></item><item><title>re: How Can I Create a Shortcut in My Network Places?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/09/how-can-i-create-a-shortcut-in-my-network-places.aspx#3300631</link><pubDate>Tue, 15 Dec 2009 10:46:48 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3300631</guid><dc:creator>kwan88</dc:creator><description>&lt;p&gt;Thanks for the script. I have changed it sightly. So that the objects in My Network Places are mapped according to which OU in AD the user is located and to what Shared Folder objects are published.&lt;/p&gt;
&lt;p&gt;The issue i have is that on a Windows 2000 SP4 the script runs very quickly however on Windows XP SP2 it takes about 4 minutes. Any ideas? WSH upgrade to 5.7 made no difference.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Const NETHOOD = &amp;amp;H13&amp;amp;&lt;/p&gt;
&lt;p&gt;'Create objects&lt;/p&gt;
&lt;p&gt;Set objFSO = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;) &lt;/p&gt;
&lt;p&gt;Set WshNetwork = CreateObject(&amp;quot;WScript.Network&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set objSysInfo = CreateObject(&amp;quot;ADSystemInfo&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set objWSHShell = CreateObject(&amp;quot;Wscript.Shell&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set objShell = CreateObject(&amp;quot;Shell.Application&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set objFolder = objShell.Namespace(NETHOOD)&lt;/p&gt;
&lt;p&gt;Set objFolderItem = objFolder.Self&lt;/p&gt;
&lt;p&gt;strNetHood = objFolderItem.Path&lt;/p&gt;
&lt;p&gt;On Error Resume Next&lt;/p&gt;
&lt;p&gt;strPath = objFolderItem.Path &amp;amp; &amp;quot;\*.*&amp;quot; &lt;/p&gt;
&lt;p&gt;On Error Resume Next &lt;/p&gt;
&lt;p&gt;objFSO.DeleteFile strPath, true &lt;/p&gt;
&lt;p&gt;'Some shortcuts are folders, loop and delete all of them too &lt;/p&gt;
&lt;p&gt;Set oFolder = objFSO.GetFolder(objFolderItem.Path) &lt;/p&gt;
&lt;p&gt;Set oSubFolders= oFolder.SubFolders &lt;/p&gt;
&lt;p&gt;For Each oCurrentSubFolder in oSubFolders &lt;/p&gt;
&lt;p&gt;On Error Resume Next &lt;/p&gt;
&lt;p&gt;objFSO.DeleteFolder oCurrentSubFolder, true &lt;/p&gt;
&lt;p&gt;Next&lt;/p&gt;
&lt;p&gt;If Instr(objSysInfo.username,&amp;quot;,&amp;quot;) &amp;lt;&amp;gt; 0 Then&lt;/p&gt;
&lt;p&gt;	UserOU=Right(objSysInfo.Username,Len(objSysInfo.Username)-Instr(objSysInfo.Username,&amp;quot;,&amp;quot;))&lt;/p&gt;
&lt;p&gt;End If&lt;/p&gt;
&lt;p&gt;'Enumerate Shares in the user OU.&lt;/p&gt;
&lt;p&gt;Set objOU = GetObject(&amp;quot;LDAP://&amp;quot; &amp;amp; UserOU)&lt;/p&gt;
&lt;p&gt;objOU.filter = Array(&amp;quot;Volume&amp;quot;)&lt;/p&gt;
&lt;p&gt;For Each objitem In objOU&lt;/p&gt;
&lt;p&gt;'Add the Published Shares in the USer OU to MY Network Places&lt;/p&gt;
&lt;p&gt;Set objShortcut = objWSHShell.CreateShortcut _ &amp;nbsp; &amp;nbsp;(strNetHood &amp;amp; &amp;quot;\&amp;quot; &amp;amp; objitem.cn &amp;amp; &amp;quot;.lnk&amp;quot;)&lt;/p&gt;
&lt;p&gt;objShortcut.TargetPath = objitem.uncname&lt;/p&gt;
&lt;p&gt;objshortcut.Description = objitem.uncname&lt;/p&gt;
&lt;p&gt;objShortcut.Save&lt;/p&gt;
&lt;p&gt;next&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3300631" width="1" height="1"&gt;</description></item></channel></rss>