Powershell LOGOFF forcefully the mentioned Users


Powershell LOGOFF forcefully the mentioned Users"

$servers =  Get-content c:\servers.csv
$username = 'clusteradmin'
ForEach ($server in $servers)
{

$session = ((quser /server:$server | ? { $_ -match $username }) -split ' +')[2]
logoff $session /server:$server

}


---

Get computers name from specified OU:

$serv = Get-ADComputer -Filter * -SearchBase "OU=Cluster-Server,DC=pugazh,DC=co,DC=in" -Properties *  | Select -Property Name

Comments

Popular posts from this blog

Troubleshooting Netlogon Error Codes

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

Troubleshooting AD Active Directory Replication Error 8456 or 8457: "The source | destination server is currently rejecting replication requests"