external help file | Module Name | online version | schema |
---|---|---|---|
PowerSponse-help.xml |
PowerSponse |
2.0.0 |
Remove files based on wildcards at the end of the path or based on regex.
Remove-File [[-ComputerName] <String[]>] [[-ComputerList] <String>] [[-Method] <String>]
[[-Session] <PSSession[]>] [[-Credential] <PSCredential>] [[-Path] <String>] [-Recurse] [[-Regex] <String>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Remove files based on wildcards at the end of the path or based on regex.
PS C:\> remove-file -ComputerName $target -path "C:\users\username\evil.exe"
Remove file based on regex. First every file is searched which matchs the path and the regex and then the remove function is called with the found files.
PS C:\> remove-file -ComputerName $target -path "C:\users\username\" -Recurse -Regex "\\\w{3}\."
Remove file based on regex. First search for every file which matches the path and the regex in all folders and subfolders and then remove the found files.
PS C:\> remove-file -ComputerName $target -path "C:\users\username\" -Recurse -Regex "\\\w{3}\." | select -ExpandProperty reason
Remove file based on regex. First search for every file which matches the path and the regex in all folders and subfolders and then remove the found files. Select only the field 'reason' to see the full list of removed files.
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).