Start specific services bulk machines


$Service_name  = “Browser”, “RpcSs” , “RemoteRegistry”

$computer = Get-Content C:\Users\lvbgsmc\Desktop\Servers.txt

Get-Service -ComputerName $computer -Name $Service_name | Start-Service

Advertisements

Start services remotelly


$Service_name = “RemoteRegistry”
$computer = Get-Content C:\Users\lvbgsmc\Desktop\Servers.txt

Get-Service -ComputerName $computer -Name $Service_name | Start-Service

AD replication health check PS command


Get-ADReplicationPartnerMetadata -Target * -Partition * | Select-Object Server,Partition,Partner,
ConsecutiveReplicationFailures,LastReplicationSuccess,LastRepicationResult | Out-GridView

Reporting on Inactive Users in Active Directory


# 30 days not login users list

Import-Module ActiveDirectory
Search-ADAccount -UsersOnly -AccountInactive -TimeSpan 30.00:00:00 |where {$_.enabled} | Export-CSV –path C:\Temp\InactiveUsers.csv

Unlock the account


Import-Module activ*
Unlock-ADAccount -Identity “CN=Test11,OU=Int_Out,OU=Bathinda,OU=Geographical,DC=hmel,DC=int”

REPADMIN


# A quick replication health report
repadmin /showrepl * /csv | ConvertFrom-CSV | Out-GridView

# Replication health for a site
repadmin /showrepl * /csv | ConvertFrom-CSV |
Where-Object {$_.”Source DSA Site” -eq “Ohio”} | Out-GridView

# Replication health grouped by naming context (database partition)
repadmin /showrepl * /csv | ConvertFrom-CSV |
Sort-Object “Naming Context” | Format-Table -GroupBy “Naming Context”

Repadmin script


@echo off
for /f “Tokens=1-4 Delims=/ ” %%i in (‘date /t’) do set dt=%%i-%%j-%%k-%%l
for /f “tokens=1-4 delims=: ” %%i in (‘time /t’) do set tm=%%i-%%j
set state=%dt%_%tm%
Repadmin /replsummary /bysrc /bydst /sort:delta >”E:\GSMC_ReplicationReports\Repl_summary\%computername%-Repl_Summary-%state%.txt”

%d bloggers like this: