One recent enhancement is the ability to store SQL Server files on SMB File Shares. In this article, we will look at Windows Server 2012’s Windows PowerShell cmdlets and WMI objects to manage SMB File Servers and SMB File Shares. These new tools are aimed at both system administrator and developers, and can be accessed to:
- Use the PowerShell command line to manage and monitor File Servers and File Shares.
- Write scripts that automate common File Server administrative tasks.
- Leverage existing PowerShell skills.
- Integrate with related PowerShell-managed components (network, block storage, cluster).
Easy Configuration Steps
The SMB PowerShell cmdlets and WMI objects are available by default in Windows Server 2012 and can be found in Windows 8 clients too. There is no need to install components, roles, role services or features to use this. The SMB cmdlets are packaged into two modules called SmbShare and SmbWitness. These modules are automatically loaded whenever you refer to any of the cmdlets included. No upfront configuration is required.
Optionally, you can load these modules manually using the following PowerShell cmdlet:
You can list all cmdlets in the SMB PowerShell modules using the following PowerShell cmdlet:
Get-Command –Module Smb*
A sample output of the same would look like:
You can obtain information about any PowerShell cmdlet (including a list of parameters) by using the Get-Help cmdlet. For example, to get help for the Get-SmbShare cmdlet, use the following PowerShell cmdlet:
Here are some simple steps for creating a SMB share for SQL Server use. Though they are simple steps, these are good to know.
- Create new file share
New-SmbShare –Name ShareName –Path C:\LocalSMBFolder
- Get a list of existing file shares
- Remove a file share
Remove-SmbShare –Name ShareName
SMB PowerShell Cmdlet List
Here is the list of SMB PowerShell cmdlets in Windows Server 2012, grouped by function.
|Server session and open file
|Client mapping and connection
|Client and server configuration
This article provides just a quick overview of what is available in SMB shares. I would love to hear from you if you have ever utilized SMB Shares in your environments before. What are all the use cases you use in your setup?