{"id":5297,"date":"2017-09-06T19:55:24","date_gmt":"2017-09-06T19:55:24","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=5297"},"modified":"2017-09-06T19:55:24","modified_gmt":"2017-09-06T19:55:24","slug":"net-share-is-my-friend","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/net-share-is-my-friend\/","title":{"rendered":"net share is my friend"},"content":{"rendered":"<p>I recently had to set-up some shares on a server box using File Explorer and the share menu option, but after a reboot they all disappeared. <\/p>\n<p>Note: I&#8217;m not concerned by this behaviour, of losing the shares, as it&#8217;s probably down to some security policy but every now and then it&#8217;s so much easier having the shares available to work from when I need to deploy apps etc.<\/p>\n<p>Anyway, using <em>net share<\/em> in a batch file saves the day.<\/p>\n<p>Just run<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nnet share\r\n<\/pre>\n<p>to view the current shares on your machine.<\/p>\n<p>Now to create a share, simply use <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nnet share DEPLOYMENT=d:\\mydeployment \/GRANT:EVERYONE, READ\r\n<\/pre>\n<p>In this case I&#8217;m actually creating a READ only share with access granted to everyone. The string to the left of the = operator is the sharename (i.e. what you&#8217;ll see or use to access the share) obviously the right hand side is the location on the machine the share points to.<\/p>\n<p>Obviously EVERYONE might by less than great in terms of security, so instead you can GRANT individual user&#8217;s access. The permission can be READ | CHANGE | FULL, see the output of net share \/?<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nThe syntax of this command is:\r\n\r\nNET SHARE\r\nsharename\r\n          sharename=drive:path &#x5B;\/GRANT:user,&#x5B;READ | CHANGE | FULL]]\r\n                               &#x5B;\/USERS:number | \/UNLIMITED]\r\n                               &#x5B;\/REMARK:&quot;text&quot;]\r\n                               &#x5B;\/CACHE:Manual | Documents| Programs | BranchCache | None]\r\n          sharename &#x5B;\/USERS:number | \/UNLIMITED]\r\n                    &#x5B;\/REMARK:&quot;text&quot;]\r\n                    &#x5B;\/CACHE:Manual | Documents | Programs | BranchCache | None]\r\n          {sharename | devicename | drive:path} \/DELETE\r\n          sharename \\\\computername \/DELETE\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently had to set-up some shares on a server box using File Explorer and the share menu option, but after a reboot they all disappeared. Note: I&#8217;m not concerned by this behaviour, of losing the shares, as it&#8217;s probably down to some security policy but every now and then it&#8217;s so much easier having [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[53],"tags":[],"class_list":["post-5297","post","type-post","status-publish","format-standard","hentry","category-windows"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=5297"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5297\/revisions"}],"predecessor-version":[{"id":5352,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5297\/revisions\/5352"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=5297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=5297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=5297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}