Skip to content

Function LocalUser

Mark Wragg edited this page Jun 17, 2019 · 2 revisions

LocalUser

SYNOPSIS

Test if a local user exists and is enabled.

DESCRIPTION

Uses the Win32_UserAccount WMI class to test if a local user exists and is enabled.

PARAMETERS

Target [String]

The local user name to test for. Eg 'Guest'

[Parameter(Mandatory, Position=1, ParameterSetName="Default")]
[Parameter(Mandatory, Position=1, ParameterSetName="Property")]
[Alias("Path")]

Should [ScriptBlock]

A Script Block defining a Pester Assertion.

[Parameter(Mandatory, Position=2, ParameterSetName="Default")]
[Parameter(Mandatory, Position=3, ParameterSetName="Property")]

Assertions

Assertions: -Be

EXAMPLES

-------------------------- EXAMPLE 1 --------------------------

LocalUser 'Guest' { Should -Not -BeNullOrEmpty }

-------------------------- EXAMPLE 2 --------------------------

LocalUser 'Guest' Disabled { Should -Be $true }

-------------------------- EXAMPLE 3 --------------------------

LocalUser 'Administrator' Disabled { Should -Be $false }