I want to check for the existance of a drive mapping (called X in this example) and if it does not exist, I want to map it. Here is what I have so far:
$driveCheck = Get-PSDrive | Where-Object { $_.Name -match "X" } | Select-Object name
# This provides the following output:
# Name
# ----
# X
$map = new-object -ComObject WScript.Network
$map.MapNetworkDrive("X:", "\\Server\Share", $true, "Domain\user", "password")