I created a simple command from powershell that maps a drive for me using the "net share" command (see below). However, i want to turn this in to a batch file so I do not have to type it every time. When I name it filename.bat and try to run it, I get a
system error 5 has occured, access denied
I assume I have to make this a powershell script. My question is, if I cant run it as a batch file, how do I run this as a powershell script so I only have to click on it to run it?
*I am extremely new to powershell
Thank you
net share myshare=z:\ /grant:user,full /users:1
You are not mapping a drive you are configuring share options for Z: drive.
Mapping a drive to a network share assigns that share a drive letter so that it’s easier to work with.
To map a network drive, type the following command and then hit Enter:
Code:
net use x: \\computer name\sharename /user username password
In order to make the connection to the shared folder permanent, you need to add the /P parameter. This will ensure the drive will remain even after a restart. In some versions of Windows, you may have to use /PERSISTENT instead of /P.
Code:
net use x: \\computer name\sharename /P:Yes
You can delete a mapped network drive using the command prompt by typing in the command below.
To delete all mapped network drives by executing below command.