Skip to content

Get-HomeDrive

SYNOPSIS

Retrieves the home drive path for an Active Directory user.

SYNTAX

Get-HomeDrive [-Identity] <String> [<CommonParameters>]

DESCRIPTION

The `Get-HomeDrive` function retrieves the home drive path for a specified Active Directory user. It checks the user's `homeDirectory` attribute and resolves the full path if the home drive is mapped to a specific location. The function also validates the existence of the home drive path.

EXAMPLES

EXAMPLE 1

Get-HomeDrive -Identity "jdoe"

Retrieves the home drive path for the user "jdoe."

EXAMPLE 2

Get-HomeDrive -Identity "CN=John Doe,OU=Users,DC=example,DC=com"

Retrieves the home drive path for the user "John Doe" using their distinguished name.

PARAMETERS

-Identity

The identity of the Active Directory user (e.g., DistinguishedName, SamAccountName, or UserPrincipalName).

Type: String
Parameter Sets: (All)
Aliases: DistinguishedName, DN, sAMAccountName, User, UserPrincipalName

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES