< Back
Assert-FileDoesNotContain
Post
NAME Assert-FileDoesNotContain
SYNOPSIS
Asserts that a file doesn not contain a string.
SYNTAX
Assert-FileDoesNotContain [[-Path] <String>] [[-Needle] <String>] [[-Message] <Object>] [<CommonParameters>]
DESCRIPTION
`Assert-FileDoesNotContain` searches a file for a string and fails if that string isf ound.
PARAMETERS
-Path <String>
The path to the file.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <String>
The string to not look for.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <Object>
A description about why the assertion might have failed.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-FileDoesNotContain 'C:\\Windows\\System32\\drivers\\etc\\hosts' '127.0.0.1'
Demonstrates how to assert that a file does not contain a string.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-FileDoesNotContain 'C:\\Windows\\System32\\drivers\\etc\\hosts' 'doubclick.net' 'Ad-blocking hosts entry
not added.'
Shows how to use the `Message` parameter to describe why the assertion might fail.
RELATED LINKS
SYNOPSIS
Asserts that a file doesn not contain a string.
SYNTAX
Assert-FileDoesNotContain [[-Path] <String>] [[-Needle] <String>] [[-Message] <Object>] [<CommonParameters>]
DESCRIPTION
`Assert-FileDoesNotContain` searches a file for a string and fails if that string isf ound.
PARAMETERS
-Path <String>
The path to the file.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <String>
The string to not look for.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <Object>
A description about why the assertion might have failed.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-FileDoesNotContain 'C:\\Windows\\System32\\drivers\\etc\\hosts' '127.0.0.1'
Demonstrates how to assert that a file does not contain a string.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-FileDoesNotContain 'C:\\Windows\\System32\\drivers\\etc\\hosts' 'doubclick.net' 'Ad-blocking hosts entry
not added.'
Shows how to use the `Message` parameter to describe why the assertion might fail.
RELATED LINKS