|
| 1 | +--- |
| 2 | +description: Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell. |
| 3 | +external help file: SmbClientAccessToServer.cdxml-help.xml |
| 4 | +Module Name: SmbShare |
| 5 | +ms.date: 02/22/2024 |
| 6 | +online version: https://learn.microsoft.com/powershell/module/smbshare/block-smbclientaccesstoserver?view=windowsserver2022-ps&wt.mc_id=ps-gethelp |
| 7 | +schema: 2.0.0 |
| 8 | +title: Block-SmbClientAccessToServer |
| 9 | +--- |
| 10 | + |
| 11 | +# Block-SmbClientAccessToServer |
| 12 | + |
| 13 | +## SYNOPSIS |
| 14 | +Blocks SMB client access to a specified server. |
| 15 | + |
| 16 | +## SYNTAX |
| 17 | + |
| 18 | +### Query |
| 19 | + |
| 20 | +``` |
| 21 | +Block-SmbClientAccessToServer [-Name] <String[]> -IdentifierType <IdentifierType> |
| 22 | + -Identifier <String> [-Description <String>] [-Force] [-CimSession <CimSession[]>] |
| 23 | + [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>] |
| 24 | +``` |
| 25 | + |
| 26 | +### InputObject |
| 27 | + |
| 28 | +``` |
| 29 | +Block-SmbClientAccessToServer -InputObject <CimInstance[]> -IdentifierType <IdentifierType> |
| 30 | + -Identifier <String> [-Description <String>] [-Force] [-CimSession <CimSession[]>] |
| 31 | + [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>] |
| 32 | +``` |
| 33 | + |
| 34 | +## DESCRIPTION |
| 35 | + |
| 36 | +The `Block-SmbClientAccessToServer` cmdlet is used to prevent SMB clients from accessing a |
| 37 | +specified server when using SMB over QUIC client access control. When you run this cmdlet, all SMB |
| 38 | +client connections to the specified server will be terminated, and no new connections will be |
| 39 | +allowed until the block is lifted. To unblock access to the server, use the |
| 40 | +`Unblock-SmbClientAccessToServer` cmdlet. |
| 41 | + |
| 42 | +## EXAMPLES |
| 43 | + |
| 44 | +### Example 1: Block SMB client access to a server |
| 45 | + |
| 46 | +```powershell |
| 47 | +$params = @{ |
| 48 | + Name = "Server01" |
| 49 | + IdentifierType = "ISSUER" |
| 50 | + Identifier = "CN=MyCertificateIssuer" |
| 51 | + Force = $true |
| 52 | +} |
| 53 | +Block-SmbClientAccessToServer @params |
| 54 | +``` |
| 55 | + |
| 56 | +This command blocks SMB client access to a server named `Server01` for the based on the client's |
| 57 | +certificate. This command runs without prompting for confirmation as the **Force** parameter is set |
| 58 | +to `$true`. |
| 59 | + |
| 60 | +## PARAMETERS |
| 61 | + |
| 62 | +### -AsJob |
| 63 | + |
| 64 | +Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to |
| 65 | +complete. |
| 66 | + |
| 67 | +```yaml |
| 68 | +Type: SwitchParameter |
| 69 | +Parameter Sets: (All) |
| 70 | +Aliases: |
| 71 | + |
| 72 | +Required: False |
| 73 | +Position: Named |
| 74 | +Default value: None |
| 75 | +Accept pipeline input: False |
| 76 | +Accept wildcard characters: False |
| 77 | +``` |
| 78 | +
|
| 79 | +### -CimSession |
| 80 | +
|
| 81 | +Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session |
| 82 | +object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession) or |
| 83 | +[Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the |
| 84 | +current session on the local computer. |
| 85 | +
|
| 86 | +```yaml |
| 87 | +Type: CimSession[] |
| 88 | +Parameter Sets: (All) |
| 89 | +Aliases: Session |
| 90 | + |
| 91 | +Required: False |
| 92 | +Position: Named |
| 93 | +Default value: None |
| 94 | +Accept pipeline input: False |
| 95 | +Accept wildcard characters: False |
| 96 | +``` |
| 97 | +
|
| 98 | +### -Description |
| 99 | +
|
| 100 | +Used to provide a description of the rule being added to the server's firewall when you use the |
| 101 | +`Block-SmbClientAccessToServer` cmdlet. This can be useful if you need to keep track of why SMB |
| 102 | +client access to a server has been blocked, or if you need to provide additional information about |
| 103 | +the block for documentation purposes. |
| 104 | + |
| 105 | +```yaml |
| 106 | +Type: String |
| 107 | +Parameter Sets: (All) |
| 108 | +Aliases: |
| 109 | +
|
| 110 | +Required: False |
| 111 | +Position: Named |
| 112 | +Default value: None |
| 113 | +Accept pipeline input: False |
| 114 | +Accept wildcard characters: False |
| 115 | +``` |
| 116 | + |
| 117 | +### -Force |
| 118 | + |
| 119 | +Forces the command to run without asking for user confirmation. |
| 120 | + |
| 121 | +```yaml |
| 122 | +Type: SwitchParameter |
| 123 | +Parameter Sets: (All) |
| 124 | +Aliases: |
| 125 | +
|
| 126 | +Required: False |
| 127 | +Position: Named |
| 128 | +Default value: None |
| 129 | +Accept pipeline input: False |
| 130 | +Accept wildcard characters: False |
| 131 | +``` |
| 132 | + |
| 133 | +### -Identifier |
| 134 | + |
| 135 | +Specifies the identity of the client that is being granted access to the SMB server. This parameter |
| 136 | +takes a string value that represents the identity of the client. The format of the string value |
| 137 | +will depend on the **IdentifierType** parameter that you're using. |
| 138 | + |
| 139 | +```yaml |
| 140 | +Type: String |
| 141 | +Parameter Sets: (All) |
| 142 | +Aliases: |
| 143 | +
|
| 144 | +Required: True |
| 145 | +Position: Named |
| 146 | +Default value: None |
| 147 | +Accept pipeline input: False |
| 148 | +Accept wildcard characters: False |
| 149 | +``` |
| 150 | + |
| 151 | +### -IdentifierType |
| 152 | + |
| 153 | +Specifies the type of identifier that you're using to identify a client. The valid values for the |
| 154 | +**IdentifierType** parameter are: |
| 155 | + |
| 156 | +- SHA256 |
| 157 | +- ISSUER |
| 158 | + |
| 159 | +If you're using the `SHA256` identifier type, you're specifying a hash value that uniquely |
| 160 | +identifies the client. If you're using the `ISSUER` identifier type, you're specifying the issuer |
| 161 | +of the client's certificate. |
| 162 | + |
| 163 | +```yaml |
| 164 | +Type: IdentifierType |
| 165 | +Parameter Sets: (All) |
| 166 | +Aliases: |
| 167 | +Accepted values: SHA256, ISSUER |
| 168 | +
|
| 169 | +Required: True |
| 170 | +Position: Named |
| 171 | +Default value: None |
| 172 | +Accept pipeline input: False |
| 173 | +Accept wildcard characters: False |
| 174 | +``` |
| 175 | + |
| 176 | +### -InputObject |
| 177 | + |
| 178 | +Specifies the input object that's used in a pipeline command. |
| 179 | + |
| 180 | +```yaml |
| 181 | +Type: CimInstance[] |
| 182 | +Parameter Sets: InputObject |
| 183 | +Aliases: |
| 184 | +
|
| 185 | +Required: True |
| 186 | +Position: Named |
| 187 | +Default value: None |
| 188 | +Accept pipeline input: True (ByValue) |
| 189 | +Accept wildcard characters: False |
| 190 | +``` |
| 191 | + |
| 192 | +### -Name |
| 193 | + |
| 194 | +Specifies a fully-qualified DNS name or NetBIOS name that must match the certificate's subject name |
| 195 | +or an entry in the certificate's subject alternative names. |
| 196 | + |
| 197 | +```yaml |
| 198 | +Type: String[] |
| 199 | +Parameter Sets: Query |
| 200 | +Aliases: |
| 201 | +
|
| 202 | +Required: True |
| 203 | +Position: 1 |
| 204 | +Default value: None |
| 205 | +Accept pipeline input: True (ByPropertyName) |
| 206 | +Accept wildcard characters: False |
| 207 | +``` |
| 208 | + |
| 209 | +### -ThrottleLimit |
| 210 | + |
| 211 | +Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If |
| 212 | +this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an |
| 213 | +optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the |
| 214 | +computer. |
| 215 | + |
| 216 | +The throttle limit applies only to the current cmdlet, not to the session or to the computer. |
| 217 | + |
| 218 | +```yaml |
| 219 | +Type: Int32 |
| 220 | +Parameter Sets: (All) |
| 221 | +Aliases: |
| 222 | +
|
| 223 | +Required: False |
| 224 | +Position: Named |
| 225 | +Default value: None |
| 226 | +Accept pipeline input: False |
| 227 | +Accept wildcard characters: False |
| 228 | +``` |
| 229 | + |
| 230 | +### -Confirm |
| 231 | + |
| 232 | +Prompts you for confirmation before running the cmdlet. |
| 233 | + |
| 234 | +```yaml |
| 235 | +Type: SwitchParameter |
| 236 | +Parameter Sets: (All) |
| 237 | +Aliases: cf |
| 238 | +
|
| 239 | +Required: False |
| 240 | +Position: Named |
| 241 | +Default value: False |
| 242 | +Accept pipeline input: False |
| 243 | +Accept wildcard characters: False |
| 244 | +``` |
| 245 | + |
| 246 | +### -WhatIf |
| 247 | + |
| 248 | +Shows what would happen if the cmdlet runs. The cmdlet isn't run. |
| 249 | + |
| 250 | +```yaml |
| 251 | +Type: SwitchParameter |
| 252 | +Parameter Sets: (All) |
| 253 | +Aliases: wi |
| 254 | +
|
| 255 | +Required: False |
| 256 | +Position: Named |
| 257 | +Default value: False |
| 258 | +Accept pipeline input: False |
| 259 | +Accept wildcard characters: False |
| 260 | +``` |
| 261 | + |
| 262 | +### CommonParameters |
| 263 | + |
| 264 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, |
| 265 | +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, |
| 266 | +-WarningAction, and -WarningVariable. For more information, see |
| 267 | +[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). |
| 268 | + |
| 269 | +## INPUTS |
| 270 | + |
| 271 | +### System.String[] |
| 272 | + |
| 273 | +### Microsoft.Management.Infrastructure.CimInstance[] |
| 274 | + |
| 275 | +## OUTPUTS |
| 276 | + |
| 277 | +### Microsoft.Management.Infrastructure.CimInstance[] |
| 278 | + |
| 279 | +## NOTES |
| 280 | + |
| 281 | +## RELATED LINKS |
| 282 | + |
| 283 | +[Get-SmbClientAccessToServer](Get-SmbClientAccessToServer.md) |
| 284 | + |
| 285 | +[Grant-SmbClientAccessToServer](Grant-SmbClientAccessToServer.md) |
| 286 | + |
| 287 | +[Revoke-SmbClientAccessToServer](Revoke-SmbClientAccessToServer.md) |
| 288 | + |
| 289 | +[Unblock-SmbClientAccessToServer](Unblock-SmbClientAccessToServer.md) |
0 commit comments