Hi
I’ve been playing with mapping network shares from domain fileserver to local computer. A small project for the users who often log on via VPN and thus doesn’t not have a domain connection while logging in…
$DriveletterF=“DOMAIN\SG - GPO - DriveMaps - ARD - Logistik”
$DriveletterG=“DOMAIN\SG - GPO - DriveMaps - QUB - Marketing”
$groups=Get-AllUserGroups | Where-Object {$_ -like “SG - GPO - DriveMaps” }
Foreach ($group in $groups)
{
#write-host $group
if ($group = $driveletterF)
{
Remove-PSDrive -Name F -Force
new-psdrive -Name “F” -PSProvider FileSystem -Root “\domain.local\arden\logistik”
}
if ($group = $driveletterG)
{
Remove-PSDrive -Name G -Force
new-psdrive -Name “G” -PSProvider FileSystem -Root “\domain.local\arden\marketing”
}
}
but if I am not member of $driveletterG group then it tries to map it anyway…
I am thinking that it must be something to do with the if’s in the foreach but not sure what…
ideas?