MCSF
asked on
Create a Share from a Remote Machine using Command Line or Script
I would like to know if there is a way to create a share remotely from a command prompt or script from a Windows machine to a non-Windows machine. I am trying to do this on a Netapp SAN. I can delete a share with this simple command:
net share test \\server /delete (test is the share name)
I don't see a way to create a remote share with net share though. There may be other ways, but a lot of the Microsoft tools rely on WMI or the RPC service, which of course does not translate to Netapp. Anyone know of a way to do this?
net share test \\server /delete (test is the share name)
I don't see a way to create a remote share with net share though. There may be other ways, but a lot of the Microsoft tools rely on WMI or the RPC service, which of course does not translate to Netapp. Anyone know of a way to do this?
ASKER
The command I used does in fact delete the share on the remote server. I have tested it to the Netapp and to a Windows server.
Yeah, I've seen all of the syntax to create a share, but it doesn't list anything to CREATE a remote share, just to delete one. Here is all of the available syntax:
NET SHARE
sharename
sharename=drive:path [/GRANT:user,[READ | CHANGE | FULL]]
[/USERS:number | /UNLIMITED]
[/REMARK:"text"]
[/CACHE:Manual | Documents| Programs | BranchCache | None]
sharename [/USERS:number | /UNLIMITED]
[/REMARK:"text"]
[/CACHE:Manual | Documents | Programs | BranchCache | None]
{sharename | devicename | drive:path} /DELETE
sharename \\computername /DELETE
Yeah, I've seen all of the syntax to create a share, but it doesn't list anything to CREATE a remote share, just to delete one. Here is all of the available syntax:
NET SHARE
sharename
sharename=drive:path [/GRANT:user,[READ | CHANGE | FULL]]
[/USERS:number | /UNLIMITED]
[/REMARK:"text"]
[/CACHE:Manual | Documents| Programs | BranchCache | None]
sharename [/USERS:number | /UNLIMITED]
[/REMARK:"text"]
[/CACHE:Manual | Documents | Programs | BranchCache | None]
{sharename | devicename | drive:path} /DELETE
sharename \\computername /DELETE
I'm still not sure how you are able to accomplish this. I have attempted to replicate with a share that I have created on a server: \\server\folder using the following:
net share \\server\folder /delete
All I get back is the shared resource does not exist.
I have attempted this from both an XP Pro and a windows 2003 server with the same results If I map a drive letter to that location then I am able to delete the drive letter from my local system however the share remains available on the remote server.
Having said that I did find this site; http://www.tech-recipes.com/rx/2981/windows_create_share_remote_pc_from_command_line/
net share \\server\folder /delete
All I get back is the shared resource does not exist.
I have attempted this from both an XP Pro and a windows 2003 server with the same results If I map a drive letter to that location then I am able to delete the drive letter from my local system however the share remains available on the remote server.
Having said that I did find this site; http://www.tech-recipes.com/rx/2981/windows_create_share_remote_pc_from_command_line/
ASKER
Your syntax is a little off. In your case it would be:
net share folder \\server /delete
Yeah, I have tried WMIC, but it relies on the RPC Windows service, which Netapp does not use.
net share folder \\server /delete
Yeah, I have tried WMIC, but it relies on the RPC Windows service, which Netapp does not use.
I tried both ways with the same result so I did some more checking:
Hey, Scripting Guy! How can I share a folder on a remote computer?
-- RS
Hey, RS. One of the great things about WMI is the fact that - with one or two fairly obscure exceptions - anything you can do on the local computer you can also do on a remote computer. This is the big advantage scripting has over command line tools; a number of command line tools (including tools like net share) work only on the local computer. If you want to do something remotely, a WMI script is often the only way to go.
This was taken from: http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/07/how-can-i-share-a-folder-on-a-remote-computer.aspx
Hey, Scripting Guy! How can I share a folder on a remote computer?
-- RS
Hey, RS. One of the great things about WMI is the fact that - with one or two fairly obscure exceptions - anything you can do on the local computer you can also do on a remote computer. This is the big advantage scripting has over command line tools; a number of command line tools (including tools like net share) work only on the local computer. If you want to do something remotely, a WMI script is often the only way to go.
This was taken from: http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/07/how-can-i-share-a-folder-on-a-remote-computer.aspx
ASKER
Nice script. Tried it out and it works great to a Windows server, but again it relies on the RPC Windows service so it fails to the Netapp. I may have to bail on this idea and just use the GUI instead....
If I follow correctly then you want to avoid going to console/GUI of the Netapp filer? One remote tool I use regularly is 'plink', part of the Putty toolset. It allows you to use your Netapp filer credentials remotely at the command line of your host, even batching commands to be run at the filer.
Sound useful?
Sound useful?
ASKER
I use Putty for the Netapp command line too. The purpose of this question is to find a way for a developer to stop a share on the Netapp so that he can make changes to an application with everyone out. Then we he is done making his changes he can create the share again. Ideally he would do this with a couple scripts or commands from a command prompt. Don't necessarily want him to be live on the Netapp command line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
because
The following would create a share locally but not remotely.
Create a new local file share
NET SHARE sharename=drive:path /REMARK:"text" [/CACHE:Manual | Automatic | No ]