File Services Getting Started Cmdlets
File Services Getting Started Cmdlets
Physical Disks List all physical disks List all physical disks sorted from large to small List all physical disks that are currently associate with a pool List all storage pools Create a new storage pool named Pool1 with 2 disks Get-PhysicalDisk Get-PhysicalDisk | Sort Size -Descending Get-StoragePool -IsPrimordial $false| Get-PhysicalDisk Get-StoragePool $pDisks= Get-PhysicalDisk $s=Get-StorageSubSystem New-StoragePool -FriendlyName "Pool1" -PhysicalDisks $pDisks[0] , $pDisks[1] -StorageSubSystemFriendlyName $s.FriendlyName New-VirtualDisk -FriendlyName "VD1" -StoragePoolFriendlyName "Pool1" -Size 100GB -ResiliencySettingName "Mirror" -ProvisioningType Thin New-VirtualDisk -FriendlyName "VD1" -StoragePoolFriendlyName "Pool1" -ResiliencySettingName "Parity" -UseMaximumSize Remove-VirtualDisk -FriendlyName "VD1" Get-Disk Get-VirtualDisk -FriendlyName "VD1" | get-disk | Initialize-Disk -PartitionStyle "MBR" Get-VirtualDisk -FriendlyName "VD1" | get-disk | New-Partition -Size 50GB -DriveLetter P Format-Volume -DriveLetter P -FileSystem NTFS -NewFileSystemLabel "Data Format-Volume -DriveLetter P -FileSystem ReFS -Confirm:$false
Storage Pool
Virtual Disk
Disk Volume
Create a 100GB virtual disk using the Mirror resiliency type and thin provisioning Create the biggest possible virtual disk using the Parity resiliency type and fixed provisioning. Simple (no resiliency) is another resiliency choice. Remove (delete) a virtual disk named VD1 List all disks visible to Windows Initialize a disk with a GPT partition on the new virtual disk Create a 50GB Partition and assign the drive letter P Format drive P with the NTFS file system and the label Data Format an ReFS volume and skip confirmation
Set-DedupVolume P: -ExcludeFileType "txt", "log" -MinimumFileAgeDays 10 Get-DedupStatus P: Get-DedupSchedule Set-DedupSchedule ThroughputOptimization-2 -Type Optimization -Start "2:00 AM" -Days "Sunday","Saturday" Start-DedupJob P: -Type Optimization
Get-DedupJob
iSCSI Target Server (for more cmdlets run gcm module iSCSITarget )
iSCSI Virtual Disk Create a new 400 MB iSCSI virtual disk Get all iSCSI virtual disks Remove an iSCSI virtual disk Create a new iSCSI target Unmask the target initiators (with IQN or DNS name list)
Get all iSCSI targets Remove a target Map an iSCSI target to a VHD Get all connected LUNs
Server Target
Shares (for more cmdlets run gcm module SMBShare and gcm module NFS )
SMB Shares Get All SMB shares Create a new SMB share named SmbShare1 on path C:\Shares\SmbShare1 with full access granted to Contoso\User1 Remove the SMB share SmbShare1 from the server Get SMB server configurations Get All NFS shares Create a new NFS Share named NFSShare1 with Krb5 authentication and Root access denied Remove the share NfsShare1 from the machine Get NFS server configuration Create a new client group ClientGrp1 and add localhost as member of the client group Get-smbshare New-SmbShare -Name "SmbShare1" -Path "c:\Shares\SmbShare1" -FullAccess "Contoso\User1"
NFS Server
Remove-SmbShare -Name "SmbShare1" Get-SmbClientConfiguration Get-NFSShare New-NfsShare -Name "NfsShare1" -Path "c:\NFS1" -Authentication krb5 -AllowRootAccess $false Remove-NfsShare -Name "NfsShare1" Get-NfsServerConfig New-NfsClientgroup -ClientGroupName "ClientGrp1" -AddMember "localhost"
Mapping
Sessions
File Server Resource Manager (for more cmdlets run gcm module FileServerResourceManager )
File Management Tasks Create a file management task that moves old (expired) HR files to a designated directory $action = New-FsrmFmjAction -ExpirationFolder "c:\Expired" -Type "Expiration" $sched = New-FsrmScheduledTask -Time "21:59" -Weekly "Sunday" $condition = New-FsrmFmjCondition -Condition "LessThan" -DateOffset "-360" -Property File.DateCreated -Value Date.Now New-FsrmFileManagementJob -Name "Expiration11" -Action $action -Schedule $sched -Condition $condition -Namespace "c:\Shares\HR" $QuotaTemplate = Get-FsrmQuotaTemplate -Name Monitor 500 MB Share" New-FsrmQuota -Path c:\Shares\HR -Template $QuotaTemplate.Name $Report = New-FsrmStorageReport -Name "LargeFilesReport" -LargeFileMinimum 100MB ReportFormat "Text" -Namespace "c:\Shares\HR " -ReportType "LargeFiles" -interactive | Wait-FsrmStorageReport Get-ChildItem -Path $Report.LastReportPath -Recurse | where { $_.Name -like "Large*.txt"} | Get-Content Set-FsrmAdrSetting -Event "AccessDenied" -Enabled:$true -DisplayMessage "Access to the share is restricted" -AllowRequests:$true -EmailMessage "Please grant me access to the share." -MailTo [email protected] -MailToOwner:$true
Portal
Connect Connect to a target Session Get the current active sessions Make the iSCSI connection persistent
Quotas
Storage Reports
Get the specified quota template Create a quota that applies the specified quota template Create an interactive storage report on large files and list the contents
AccessDenied Assistance
Enables customized access denied messages for shares on this server and allows access requests to be sent to the server admin and share owner