Hi guys, i need your help. I would like to create a simple scritp to optain a groupname if it exists. I did it:
Import-Module ActiveDirectory
$today = Get-Date -f dd.MM.yyyy_ore_HH_mm
$srvname = Read-Host 'Server Name?'
$path = "\\tstsrv001\c$\tmp\$srvname\"
if(!(Test-Path -Path $path )){
New-Item -ItemType directory -Path $path
}
$group = Get-ADGroup -Filter {name -like "*$srvname*"} | select SamAccountName
Out-File -FilePath "$path\$today.txt" -append
The only thing i need are the groups name where $srvname is present.
Thanks!!!!!!