Jump to content

Recommended Posts

Posted

Hi,

I am writing a program to add a shared network drive (Z:) but this is active (listed into Computer Resource) only after a shoutdown. I need to see it immediately, how I can do?

These i.e. of information saved into the registry:

[HKEY_CURRENT_USER\Network\Z]

"RemotePath"="\\\\Test\\C"

"UserName"=""

"ProviderName"="Rete di Microsoft Windows"

"ProviderType"=dword:00020000

"ConnectionType"=dword:00000001

"DeferFlags"=dword:00000004

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU]

"a"="\\\\Test\\C"

"MRUList"="a"

[HKEY_USERS\S-1-5-21-1177238915-682003330-1136304460-1003\Network\Z]

"RemotePath"="\\\\Test\\C"

"UserName"=""

"ProviderName"="Rete di Microsoft Windows"

"ProviderType"=dword:00020000

"ConnectionType"=dword:00000001

"DeferFlags"=dword:00000004

[HKEY_USERS\S-1-5-21-1177238915-682003330-1136304460-1003\Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU]

"a"="\\\\Test\\C"

"MRUList"="a"

Thanks in advance.


Posted

You may be making this more difficult than it has to be...

You could just use the following in a .cmd file

NET USE Z: \\server\share [/PERSISTENT:YES]

Where "\\server\share" represents the UNC path you are trying to map to the drive letter "Z". Use the /PERSISTENT:YES switch to reconnect the mapped drive at the next logon.

If I read your question right, this should do what you're trying to achieve.

Posted

First thing: Thanks for the answer!

Second: in a first time I had tried your suggest without success, today, tring again, calling a Shell with Net Use the connection will show inside shred drive list...

This time I have put a little wait function before proced with my elaboration (I'm writing a software to read and elaborate some files and send the results to the shared drive) and this time has work.

I will make some other tests and if something strange I will write here...

Anyway, thanks for help.

Posted (edited)
(I'm writing a software to read and elaborate some files and send the results to the shared drive)

If all you're doing is writing some data to the share you don't even need to map it. Just have the output go directly to the UNC (i.e. \\server\share\file.txt).

For example, if I wanted to capture the output of IPCONFIG /ALL to a text file using the computers name and the server name is MYSRV and the share name is IPDATA$ then I would issue the following command at a command prompt:

IPCONFIG /ALL > \\MYSRV\IPDATA$\%COMPUTERNAME%.txt

The %COMPUTERNAME% syntax is a system variable. So if the computer was named MYCOMP the resulting output would be MYCOMP.txt. Since you can't have two computers on the network with the same name, this would ensure that no file would get overwritten unless the command is run on the same computer again.

Edited by nmX.Memnoch

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...