6.If you need to connect to the share using different user credentials, select the Connect Using Different Credentials check box.
7.Tap or click Finish. If you are connecting using different credentials, enter the user name and password when prompted. Enter the user name in Domain\Username format, such as Cpandl\Williams. Before tapping or clicking OK, select Remember My Credentials if you want the credentials to be saved. Otherwise, you’ll need to provide credentials in the future.
After you connect to a special share, you can access it as you would any other drive. Because special shares are protected, you don’t have to worry about ordinary users accessing these shares. The first time you connect to the share, you might be prompted for a user name and password. If you are prompted, provide that information.
Viewing user and computer sessions
You can use Computer Management to track all connections to shared resources on a Windows Server 2012 R2 system. Whenever a user or computer connects to a shared resource, Windows Server 2012 R2 lists a connection in the Sessions node.
To view connections to shared resources, enter net sessionat an elevated command prompt or Get-SMBSession at an elevated Windows PowerShell prompt. You also can follow these steps:
1.In Computer Management, connect to the computer on which you created the shared resource.
2.In the console tree, expand System Tools, expand Shared Folders, and then select Sessions. You can now view connections to shares for users and computers.
The columns for the Sessions node provide the following important information about user and computer connections:
■ UserThe names of users or computers connected to shared resources. Computer names are shown with a $ suffix to differentiate them from users.
■ ComputerThe name of the computer being used.
■ TypeThe type of network connection being used.
■ # Open FilesThe number of files with which the user is actively working. For more detailed information, access the Open Files node.
■ Connected TimeThe time that has elapsed since the connection was established.
■ Idle TimeThe time that has elapsed since the connection was last used.
■ GuestWhether the user is logged on as a guest.
As shown in the following example, the output of Get-SMBSession provides the session ID, client computer name, client user name and the number of open files for each session:
SessionId |
ClientComputerName |
ClientUserName |
NumOpens |
601295421497 |
10.0.0.60 |
CPANDL\williams |
2 |
Managing sessions and shares
Managing sessions and shares is a common administrative task. Before you shut down a server or an application running on a server, you might want to disconnect users from shared resources. You might also need to disconnect users when you plan to change access permissions or delete a share entirely. Another reason to disconnect users is to break locks on files. You disconnect users from shared resources by ending the related user sessions.
ENDING INDIVIDUAL SESSIONS
To disconnect individual users from shared resources, enter net session \\ computername /deleteat an elevated command prompt or Close-SMBSession at -Computer Name computername an elevated Windows PowerShell prompt. In both instances, computername is the DNS name or IP address of computer from which the session originates.
You also can disconnect users by following these steps:
1.In Computer Management, connect to the computer on which you created the share.
2.In the console tree, expand System Tools, expand Shared Folders, and then select Sessions.
3.Press and hold or right-click the user sessions you want to end, and then tap or click Close Session.
4.Tap or click Yes to confirm the action.
ENDING ALL SESSIONS
To disconnect all users from shared resources, follow these steps:
1.In Computer Management, connect to the computer on which you created the share.
2.In the console tree, expand System Tools, expand Shared Folders, and then press and hold or right-click Sessions.
3.Tap or click Disconnect All Sessions, and then tap or click Yes to confirm the action.
NOTE Keep in mind that you’re disconnecting users from shared resources, not from the domain. You can use only logon hours and Group Policy to force users to log off after they’ve logged on to the domain. Thus, disconnecting users doesn’t log them off the network. It just disconnects them from the shared resource.
To disconnect individual users from shared resources, enter net session \\ computername /deleteat an elevated command prompt or Close-SMBSession at -ComputerName computername an elevated Windows PowerShell prompt. In both instances, computername is the DNS name or IP address of computer from which the session originates.
You also can use Windows PowerShell to disconnect all users from a shared resource. The key here is to ensure you only close the sessions you want to close. Consider the following example:
ForEach-Object ($Session in (Get-SMBSession)) {Close-SMBSession -force}
This example uses a ForEach loop to get all active SMB sessions and then close each SMB session in turn. Thus, if you enter this example at an elevated Windows PowerShell prompt, you will disconnect all users from all shared resources.
To close all connections only for a specific share, you must create a ForEach loop that only examines the connections for that share, such as:
ForEach-Object ($Session in (Get-SMBShare CorpData | Get-SMBSession)) {Close-SMBSession -force}
This example uses a ForEach loop to get all active SMB sessions for the CorpData share and then close each of those sessions in turn. Thus, if you enter this example at an elevated Windows PowerShell prompt, you only disconnect users from the CorpData share.
Managing open resources
Any time users connect to shares, the individual file and object resources they are working with are displayed in the Open Files node. The Open Files node might show the files the user has open but isn’t currently editing.
You can access the Open Files node by following these steps:
1.In Computer Management, connect to the computer on which you created the share.
2.In the console tree, expand System Tools, expand Shared Folders, and then select Open Files. This displays the Open Files node, which provides the following information about resource usage:
■ Open FileThe file or folder path to the open file on the local system. The path might also be a named pipe, such as \PIPE\spools, which is used for printer spooling.
■ Accessed ByThe name of the user accessing the file.
■ TypeThe type of network connection being used.
■ # LocksThe number of locks on the resource.
■ Open ModeThe access mode used when the resource was opened, such as read, write, or write+read.
You also can use Get-SMBOpenFile to list open files. As shown in the following example, Get-SMBOpenFile provides the file ID, session ID, path, share relative path, client computer name, and client user name for each open file:
Читать дальше