PowerShell Logo Small

Close-SmbOpenFile



This is the built-in help made by Microsoft for the command 'Close-SmbOpenFile', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Forcibly closes a file that is open by one of the clients of the Server Message Block (SMB) server.

SYNTAX


Close-SmbOpenFile [[-FileId] <UInt64[]>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ClientComputerName <String[]>]
[-ClientUserName <String[]>] [-ClusterNodeName <String[]>] [-Force [<SwitchParameter>]] [-PassThru [<SwitchParameter>]] [-ScopeName
<String[]>] [-SessionId <UInt64[]>] [-ThrottleLimit <Int32>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
Close-SmbOpenFile [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-Force [<SwitchParameter>]] [-PassThru [<SwitchParameter>]]
[-ThrottleLimit <Int32>] -InputObject <CimInstance[]> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Close-SMBOpenFile cmdlet forcibly closes a file that is open by one of the clients of the Server Message Block (SMB) server. This cmdlet
should be used with care as it may result in data loss to the client for which the file is being closed if the client has not flushed all of
the file modifications back to the server before the file is closed.



<

RELATED LINKS

Get-SmbOpenFile

REMARKS

<

Examples


EXAMPLE 1

PS C:\> Close-SmbOpenFile -FileId 4415226383589
Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383589'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N



This example closes a file identified as 4415226383589 that is open by one of the clients of the SMB server.




EXAMPLE 2

PS C:\> Close-SmbOpenFile -SessionId 4415226380393
Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383589'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N

Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383529'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N

Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383517'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N

Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383521'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N

Confirm
Are you sure you want to perform this action?
Performing operation 'Close-File' on Target '4415226383569'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): N



This example closes one or more files that are open by one of the client identified with the session identifier (ID) 4415226380393 of the SMB
server.




EXAMPLE 3

PS C:\> Get-SmbOpenFile | Where-Object -Property ShareRelativePath -Match ".DOCX" | Close-SmbOpenFile –Force



This example closes, without user confirmation, one or more files that are open by one of the clients of the SMB server and that match the
file extension ".DOCX".