external help file | Module Name | online version | schema |
---|---|---|---|
PowerSponse-help.xml |
PowerSponse |
2.0.0 |
Remove directories based on wildcards at the end of the path or based on regex.
Remove-Directory [[-ComputerName] <String[]>] [[-ComputerList] <String>] [[-Method] <String>]
[[-Session] <PSSession[]>] [[-Credential] <PSCredential>] [[-Path] <String>] [-Recurse] [[-Regex] <String>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Remove directories based on wildcards at the end of the path or based on regex.
PS C:\> Remove-Directory -ComputerName $target -path "C:\users\username\folder\"
Remove folder on remote host.
PS C:\> Remove-Directory -ComputerName $target -path "C:\users\username\folder\" | select -ExpandProperty reason
Remove folder on remote host and select only the field 'reason'.
PS C:\> remove-Directory -ComputerName $target -path C:\users\username\ -Recurse -Regex "fs\w{4}$" | select -ExpandProperty reason
Remove folder on remote host based on regex for folder name. Select only the reason field to see full list of removed folders.
PS C:\> remove-Directory -ComputerName $target -path C:\users\username\ -Recurse -Regex "fs\w{4}$" -WhatIf
Remove folder on remote host but this time only see what the command
would do using the -WhatIf
parameter.
PS C:\> remove-Directory -ComputerName host1,host2 -path "C:\users\*\appdta"
Remove folder on multiple remote host at once.
List of target computers in a file.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
List of target computers.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Benannt
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Credentials for remote computer.
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Method used for remote access.
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: WinRM
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Path to the file (filter with -Regex).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Should the search also include subfolders.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Benannt
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Regex used for filtering.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
PSSession for remote access.
Type: PSSession[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Benannt
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).