In the Creating and securing SMB shares recipe, you created a share on FS1
. Files shared using SMB act and feel like local files when you access the share, for example, via Explorer.
In this recipe, you access the Foo
share on FS1
from the CL1
Windows 10 system you created in Chapter 1, Establishing a PowerShell Administrative Environment.
You should have completed the Creating and securing SMB shares recipe. Additionally, you should have the CL1
Windows 10 system up and working—you created this system in Chapter 1, Establishing a PowerShell Administrative Environment.
You should run this recipe in an elevated console.
Get-SmbClientConfiguration
$CHT = @{Confirm=$false} Set-SmbClientConfiguration -RequireSecuritySignature $True @CHT
Get-SmbClientNetworkInterface | Format-Table Friendlyname, RSS*, RD*, Speed, IpAddresses
FS1
:$FS1CS = New-CimSession -ComputerName FS1 Get-SmbShare -CimSession $FS1CS
R:
to the share on the FS1
server:New-SmbMapping -LocalPath R: -RemotePath \FS1.Reskit.OrgFoo
CL1
:Get-SmbMapping
Get-ChildItem -Path R:
Get-SmbConnection
FS1
:Notepad R:Foo.Txt # created in an earlier recipe Get-SmbOpenFile -CimSession $FS1CS
In step 1, you view the SMB client configuration, which looks like this:
In step 2, you explicitly set the SBM to require the signing of SMB packets. This step creates no output.
In step 3, you look at the SMB client's network interface details, which look something like this:
In step 4, you set up a CIM session to FS1
, then use that session to determine the shares being offered by FS1
, which looks like this:
In step 5, you create a new client-side drive mapping, mapping the R:
drive on CL1
to the \FS1Foo
share. The output looks like this:
In step 6, you view the client-side drive mappings, which looks like this:
In step 7, you use the Get-ChildItem
cmdlet to view the contents of the R:
drive, and see what files exist on the Foo
share of FS1
. The output of this step looks like this:
In step 8, you open a file on R:
in the Notepad
drive and then use the CIM session (which you created in step 4) to view the open connections to FS1
. The output looks like this:
In the final step, step 9, you view the files and folders that are open on FS1
, which looks like this:
In step 4, you create a CIM session from CL1
to FS1
, and check which shares are provided by FS1
. There's no cmdlet equivalent of the net view <servername>
command.
In step 7, since you have set permissions, a regular domain admin account has no access. It needs to be part of the Sales
or Salesadmin
groups.
In step 9, you used Get-SmbOpenFile
to see the files open on FS1
. As you can see, details of the open file and the computer making the connection are clearly shown. You get both a full path for each open file or folder, as well as a share-relative path. What the output shows is that R:Foo.Txt
from CL1
is C:FooFoo.Txt
on FS1
.
3.139.80.209