Hello People.
Im currently looking for help to complete a script.
I want the script to look for folder (Personal drives) that are not connected to ADUsers anymore - because then we can save Space by deleting these folders.
So far ive came up with this:
cls
Import-ModuleActiveDirectory
$Folder=Get-ChildItem-PathC:\test\-Recurse
$Users=Get-ADUser-Filter* -SearchBase"OU=Administrators,OU=USers,OU=Home,DC=ksldom,DC=dk"-PropertiesSamAccountName
$FolderName=$Folder.FullName
if($Folder.Name-eq$Users)
{
Stop-Service-NameSpooler
}
Get-Service-NameSpooler
Start-Service-NameSpooler
Why is the service not getting stopped? if i put it as -neq then it stops the service.
Datatechnician