[Autogenerated] Let's now jump into managing file and
storage services with PowerShell this module.
We're going to dig in and see exactly how you can manage all
of the storage things with PowerShell.
So let's not waste time and dive one in.
We're gonna move right into a demo.
We're going to set up a file share from start to finish.
First.
We'll leverage the new S and B share command to establish a new file share
for an hr department demonstrating access and a quota.
We won't stop there though.
We'll use GS and B share to confirm its successful creation.
And finally, we'll map this new share as a network drive on a client machine.
This is the real proof of the pudding showing that the share
is not just created but fully functional.
So get ready.
We're diving in.
All right.
So I have here on my domain.
Join Windows 10 desktop.
I've got PowerShell seven Open and I'm remotely connected to our file server.
SRV one to create a new S and B share.
Now,
the first step is to actually create the SNB share with
the new S and B share command lit.
So I'll create this share and I'll call it HR files.
I'll set the path to see hr files on the SRV one server.
That's where the folder is located on the file system.
Initially, I'm going to give the prec created hr dash admins,
ad group, full access to it all that should be there.
So let's now verify it was created properly by getting
the share and filtering it on the name.
Now, let's see if it was actually created.
You'll see that here by default.
Whenever you run, get S and B share, it returns all the shares,
even the hidden ones on the system.
So if you just want to find a single share,
then you can just specify the name parameter and provide it the name.
It is created.
Now, since I'm on my SOV one server, I will exit back out of this remote session.
And now I want to map a drive letter on this client machine
to this new share to test accessing it.
So notice that the file path is on the SV one server and I
was connecting to that hr files share.
All right.
It says it does not exist or it is not a folder.
There is a problem somewhere.
Let's figure it out.
Let's first see if that SB one slash hr file share can
actually be accessed and to do that, I can use test path,
all access to the path is denied.
Now, let's see what I'm logged in as there we go ps resist admins Adam.
OK.
That's the problem.
I am not in that Hr Admins group.
Let's change that.
I now have another PowerShell session up and I'm
going to connect to the domain controller,
which in this case,
it is the same SRV one server and add myself into that HR Admins group.
All right.
So now using a 80 group member, I should be a member of that HR Admins group.
Now, let's go back to other PowerShell session.
Now let's run test path again and it says it is night.
Looks like we're going to have to log off and log back in again.
Or maybe I can just open up another powers chest and, and run it as myself.
So it authenticates again.
Let's see if that works.
Now to run as a different user.
I have to open this up from file explorer.
So I'll right-click on the PowerShell shortcut,
click,
open file location and then I have a here I hold shift
and right-click and now you see, run as a different user.
Let's see if this works.
Yeah, it looks like it works.
OK?
So that's a quick shortcut.
You can get around by logging in as yourself again,
if you're already logged in,
instead of logging off your machine and logging back in,
let's blow this up a little bit so you can see it a little better.
And now let's try this again.
We're going to map it to the H drive and now it looks like it worked great.
Now, let's see if I can actually copy a file to it.
I have a file in C hr folder called sample dot PDF.
And I'm just going to set the destination to my H drive.
Looks like it works.
Lets confirm that.
And voila it is working.
So there it is.
So I've demonstrated creating the SMB she moli verified that
exists and mapped and tested it from my local Windows 10
machine And once testing is complete, just to show you the complete workflow,
I can remove the share when no longer needed by writing,
remove SMB share.
In this case,
I don't want to open up an interactive PowerShell or
moting session with inter PS session.
So I'm just going to run invoke command and pass the script lock,
uh remove S and NB share and then specify the share name of HR files and
the computer name of SRV one which the share is on.
So I've added the force parameter here to ensure that the share is
removed even if there are open files or connections.
So by default, it will not remove that and no airs means it was successful.
So that wraps up fully provisioning and testing an S
and B share with PowerShell remoting.