Adding FTP location to My Network Places using scripting

B

Bill

Hello all:

Is there a way to script the addition (persistent or
otherwise) of an FTP location to a user's My Network
Places. I'm open to either a simple batch script command
or WSH. Any assistance is greatly appreciated.

Thanks in advance...

Bill
 
M

Marty List

Bill said:
Hello all:

Is there a way to script the addition (persistent or
otherwise) of an FTP location to a user's My Network
Places. I'm open to either a simple batch script command
or WSH. Any assistance is greatly appreciated.

Thanks in advance...

Bill


Hopefully someone knows of a supported, documented function to add these,
but they are just shell folders under "%USERPROFILE%\NetHood\". You
can manually create them using a combination of Desktop.ini and a .LNK
shortcut.

The contents of desktop.ini tell Explorer to display different contents, so
the real folder contents are hidden from you. You need to poke around using
a command prompt:


C:\>Dir "%USERPROFILE%\NetHood\"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and Settings\Marty.OPTIMUMX\NetHood

09/17/2003 05:51 PM <DIR> .
09/17/2003 05:51 PM <DIR> ..
01/28/2003 06:35 PM <DIR> c$ on Starone
03/19/2003 08:47 AM <DIR> ftp.microsoft.com
09/17/2003 05:51 PM <DIR> ftp.symantec.com
05/04/2003 09:47 PM <DIR> Marty$ on File Server, MP3 Server
(Tool)
11/22/2002 09:05 PM <DIR> My Web Sites on MSN
0 File(s) 0 bytes
7 Dir(s) 3,143,852,032 bytes free

C:\>Dir "%USERPROFILE%\NetHood\ftp.microsoft.com"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and
Settings\Marty.OPTIMUMX\NetHood\ftp.microsoft.com


03/19/2003 08:47 AM <DIR> .
03/19/2003 08:47 AM <DIR> ..
03/19/2003 08:47 AM 75 Desktop.ini
03/19/2003 08:47 AM 190 target.lnk
2 File(s) 265 bytes
2 Dir(s) 3,143,852,032 bytes free

C:\>Type "%USERPROFILE%\NetHood\ftp.microsoft.com\Desktop.ini"
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2
 
V

vagabond

I have been struggling with this for the last couple of weeks, trying to create a Network Place link to the Exchange public folder tree. Seems there is no documented/supported way to do this programmatically.

Well..., there is on Google reference to a file netplace.dll (which you can find if you look hard enough - search for references to it, find that it no longer exists, then use the wayback machine).

It allows something like:
-----
' VBScript.
Option Explicit
Dim np
' On error resume next
set np = createobject("netplace.networkplace")
np.displayname = "My web folder" 'the standard form is "path on server"
np.path = "http://strider/public" 'http: and ftp: seem valid, maybe file: too?
np.create
....
-----
to work, but only on the local machine (ie where netplace.dll is registered).

However, I get this to work perfectly by GP logon script:

First, manually create the network place
Then copy the two files (desktop.ini and target.lnk to a network share)
You'll need to run attrib -S -H on desktop.ini before you can move it.

Then this batch file does the rest:

-----
rmdir /S /Q "C:\Documents and Settings\%username%\NetHood\Public Folders"
mkdir "C:\Documents and Settings\%username%\NetHood\Public Folders"
copy \\Exchange\Scripts$\AllPublicFolders\*.* "c:\Documents and Settings\%username%\nethood\Public Folders"
attrib +S +H "c:\Documents and Settings\%username%\nethood\Public Folders\desktop.ini"
attrib +S "c:\Documents and Settings\%username%\nethood\Public Folders"
-----

HTH

john




Marty List said:
Bill said:
Hello all:

Is there a way to script the addition (persistent or
otherwise) of an FTP location to a user's My Network
Places. I'm open to either a simple batch script command
or WSH. Any assistance is greatly appreciated.

Thanks in advance...

Bill


Hopefully someone knows of a supported, documented function to add these,
but they are just shell folders under "%USERPROFILE%\NetHood\". You
can manually create them using a combination of Desktop.ini and a .LNK
shortcut.

The contents of desktop.ini tell Explorer to display different contents, so
the real folder contents are hidden from you. You need to poke around using
a command prompt:


C:\>Dir "%USERPROFILE%\NetHood\"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and Settings\Marty.OPTIMUMX\NetHood

09/17/2003 05:51 PM <DIR> .
09/17/2003 05:51 PM <DIR> ..
01/28/2003 06:35 PM <DIR> c$ on Starone
03/19/2003 08:47 AM <DIR> ftp.microsoft.com
09/17/2003 05:51 PM <DIR> ftp.symantec.com
05/04/2003 09:47 PM <DIR> Marty$ on File Server, MP3 Server
(Tool)
11/22/2002 09:05 PM <DIR> My Web Sites on MSN
0 File(s) 0 bytes
7 Dir(s) 3,143,852,032 bytes free

C:\>Dir "%USERPROFILE%\NetHood\ftp.microsoft.com"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and
Settings\Marty.OPTIMUMX\NetHood\ftp.microsoft.com


03/19/2003 08:47 AM <DIR> .
03/19/2003 08:47 AM <DIR> ..
03/19/2003 08:47 AM 75 Desktop.ini
03/19/2003 08:47 AM 190 target.lnk
2 File(s) 265 bytes
2 Dir(s) 3,143,852,032 bytes free

C:\>Type "%USERPROFILE%\NetHood\ftp.microsoft.com\Desktop.ini"
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2
 
V

vagabond

Final adjustment

attrib +R seems to be the correct setting for the directory, eg

attrib +R "c:\Documents and Settings\%username%\nethood\Public Folders"

(+S works but makes it invisible in a dir, no attribute causes the folder to behave as a regular folder)

john

I have been struggling with this for the last couple of weeks, trying to create a Network Place link to the Exchange public folder tree. Seems there is no documented/supported way to do this programmatically.

Well..., there is on Google reference to a file netplace.dll (which you can find if you look hard enough - search for references to it, find that it no longer exists, then use the wayback machine).

It allows something like:
-----
' VBScript.
Option Explicit
Dim np
' On error resume next
set np = createobject("netplace.networkplace")
np.displayname = "My web folder" 'the standard form is "path on server"
np.path = "http://strider/public" 'http: and ftp: seem valid, maybe file: too?
np.create
....
-----
to work, but only on the local machine (ie where netplace.dll is registered).

However, I get this to work perfectly by GP logon script:

First, manually create the network place
Then copy the two files (desktop.ini and target.lnk to a network share)
You'll need to run attrib -S -H on desktop.ini before you can move it.

Then this batch file does the rest:

-----
rmdir /S /Q "C:\Documents and Settings\%username%\NetHood\Public Folders"
mkdir "C:\Documents and Settings\%username%\NetHood\Public Folders"
copy \\Exchange\Scripts$\AllPublicFolders\*.* "c:\Documents and Settings\%username%\nethood\Public Folders"
attrib +S +H "c:\Documents and Settings\%username%\nethood\Public Folders\desktop.ini"
attrib +S "c:\Documents and Settings\%username%\nethood\Public Folders"
-----

HTH

john




Marty List said:
Bill said:
Hello all:

Is there a way to script the addition (persistent or
otherwise) of an FTP location to a user's My Network
Places. I'm open to either a simple batch script command
or WSH. Any assistance is greatly appreciated.

Thanks in advance...

Bill


Hopefully someone knows of a supported, documented function to add these,
but they are just shell folders under "%USERPROFILE%\NetHood\". You
can manually create them using a combination of Desktop.ini and a .LNK
shortcut.

The contents of desktop.ini tell Explorer to display different contents, so
the real folder contents are hidden from you. You need to poke around using
a command prompt:


C:\>Dir "%USERPROFILE%\NetHood\"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and Settings\Marty.OPTIMUMX\NetHood

09/17/2003 05:51 PM <DIR> .
09/17/2003 05:51 PM <DIR> ..
01/28/2003 06:35 PM <DIR> c$ on Starone
03/19/2003 08:47 AM <DIR> ftp.microsoft.com
09/17/2003 05:51 PM <DIR> ftp.symantec.com
05/04/2003 09:47 PM <DIR> Marty$ on File Server, MP3 Server
(Tool)
11/22/2002 09:05 PM <DIR> My Web Sites on MSN
0 File(s) 0 bytes
7 Dir(s) 3,143,852,032 bytes free

C:\>Dir "%USERPROFILE%\NetHood\ftp.microsoft.com"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and
Settings\Marty.OPTIMUMX\NetHood\ftp.microsoft.com


03/19/2003 08:47 AM <DIR> .
03/19/2003 08:47 AM <DIR> ..
03/19/2003 08:47 AM 75 Desktop.ini
03/19/2003 08:47 AM 190 target.lnk
2 File(s) 265 bytes
2 Dir(s) 3,143,852,032 bytes free

C:\>Type "%USERPROFILE%\NetHood\ftp.microsoft.com\Desktop.ini"
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2
 
V

vagabond

Just in case anyone's reading this, "C:\....%username%....." works on some of my networks whilst "%UserProfile%\NetHood....." works on all.

Final adjustment

attrib +R seems to be the correct setting for the directory, eg

attrib +R "c:\Documents and Settings\%username%\nethood\Public Folders"

(+S works but makes it invisible in a dir, no attribute causes the folder to behave as a regular folder)

john

I have been struggling with this for the last couple of weeks, trying to create a Network Place link to the Exchange public folder tree. Seems there is no documented/supported way to do this programmatically.

Well..., there is on Google reference to a file netplace.dll (which you can find if you look hard enough - search for references to it, find that it no longer exists, then use the wayback machine).

It allows something like:
-----
' VBScript.
Option Explicit
Dim np
' On error resume next
set np = createobject("netplace.networkplace")
np.displayname = "My web folder" 'the standard form is "path on server"
np.path = "http://strider/public" 'http: and ftp: seem valid, maybe file: too?
np.create
....
-----
to work, but only on the local machine (ie where netplace.dll is registered).

However, I get this to work perfectly by GP logon script:

First, manually create the network place
Then copy the two files (desktop.ini and target.lnk to a network share)
You'll need to run attrib -S -H on desktop.ini before you can move it.

Then this batch file does the rest:

-----
rmdir /S /Q "C:\Documents and Settings\%username%\NetHood\Public Folders"
mkdir "C:\Documents and Settings\%username%\NetHood\Public Folders"
copy \\Exchange\Scripts$\AllPublicFolders\*.* "c:\Documents and Settings\%username%\nethood\Public Folders"
attrib +S +H "c:\Documents and Settings\%username%\nethood\Public Folders\desktop.ini"
attrib +S "c:\Documents and Settings\%username%\nethood\Public Folders"
-----

HTH

john




Marty List said:
Bill said:
Hello all:

Is there a way to script the addition (persistent or
otherwise) of an FTP location to a user's My Network
Places. I'm open to either a simple batch script command
or WSH. Any assistance is greatly appreciated.

Thanks in advance...

Bill


Hopefully someone knows of a supported, documented function to add these,
but they are just shell folders under "%USERPROFILE%\NetHood\". You
can manually create them using a combination of Desktop.ini and a .LNK
shortcut.

The contents of desktop.ini tell Explorer to display different contents, so
the real folder contents are hidden from you. You need to poke around using
a command prompt:


C:\>Dir "%USERPROFILE%\NetHood\"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and Settings\Marty.OPTIMUMX\NetHood

09/17/2003 05:51 PM <DIR> .
09/17/2003 05:51 PM <DIR> ..
01/28/2003 06:35 PM <DIR> c$ on Starone
03/19/2003 08:47 AM <DIR> ftp.microsoft.com
09/17/2003 05:51 PM <DIR> ftp.symantec.com
05/04/2003 09:47 PM <DIR> Marty$ on File Server, MP3 Server
(Tool)
11/22/2002 09:05 PM <DIR> My Web Sites on MSN
0 File(s) 0 bytes
7 Dir(s) 3,143,852,032 bytes free

C:\>Dir "%USERPROFILE%\NetHood\ftp.microsoft.com"
Volume in drive C has no label.
Volume Serial Number is F021-FA97

Directory of C:\Documents and
Settings\Marty.OPTIMUMX\NetHood\ftp.microsoft.com


03/19/2003 08:47 AM <DIR> .
03/19/2003 08:47 AM <DIR> ..
03/19/2003 08:47 AM 75 Desktop.ini
03/19/2003 08:47 AM 190 target.lnk
2 File(s) 265 bytes
2 Dir(s) 3,143,852,032 bytes free

C:\>Type "%USERPROFILE%\NetHood\ftp.microsoft.com\Desktop.ini"
[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2
 
G

Gary Smith

vagabond said:
Just in case anyone's reading this, "C:\....%username%....." works on
some of my networks whilst "%UserProfile%\NetHood....." works on all.

That's probably because the profile name and the username don't have to be
the same. They're the same by default, but either can be renamed without
changing the other. Using %UserProfile% is both shorter and more
reliable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top