Posts

Showing posts with the label powershell

Correct Way to Rename an Active Directory Domain Controller

If you rename your DC by renaming a Domain Controller in the normal way you would rename a computer (using the System > Rename this PC gui), you didn’t do it right and your metadata is likely irreversibly damaged. However, I have seen success in this situation when multiple DC’s exist by demoting a re-promoting the DC. If only a single DC exists I would say its maybe a good idea to follow the below guide as it may get your out of the proverbial but probably not recommended and you may have to rely on backups.  Use the below method carefully to rename your DC in a right way and for a smooth migration Step 1: Getting ready. Open a command prompt. (Windows key+r (run) + cmd) Step 2: Adding an alternate computer name. SYNTAX : netdom computername <currentDC FQDN> / add:<newDCName FQDN> In the command prompt, type (minus quotes) “netdom computername wrongname.domain.local /add:server.domain.local“   This should return with “Added (NAME) as an alte...

Add User To The Local Administrators Group On Multiple Computers Using PowerShell

  To achieve the objective I’m using the Invoke-Command PowerShell cmdlet which allows us to run PowerShell commands to local or remote computers. In the example below, I’ll add my User ABC to the local Administrators group on two Server (serv1, serv2) Invoke-Command -ComputerName Serv1, Serv2 -ScriptBlock {add-LocalGroupMember -Group "Remote Desktop Users" -Member ABC }   There is another everyone's favorite way here along with input file and result comment: $Computerlist = get-content "C:\temp\servers.txt" foreach ($computername in $computerlist) { Invoke-Command -ComputerName $computername -ScriptBlock {add-LocalGroupMember -Group "Administrators" -Member GIN } Write-host "ABC User added in $computername" }    

How to Get LUN WWN ID on Windows Server 2012 Operating System

Go to powershell and run below mentioned command. Get-Disk -Number 17 | Select UniqueId   Replace numeric digit with actual disk ID (can fetch that from disk management console) output : UniqueId -------- 60002AC0000000000000006A003430FA

How to check AD LDS or AD DS replication ?

The AD replication PowerShell cmdlets that we’ll look at are available on Windows Server 2012, Windows Server 2012 R2, Windows 8.0 and Windows 8.1. You must install Remote Server Administration Tools (RSAT) for AD DS on non-domain controllers to use these PowerShell cmdlets. 1. Get-ADReplicationFailure The Get-ADReplicationFailure PowerShell cmdlet can be used to check AD replication status for all or specific Active Directory domain controllers. The Get-ADReplicationFailure cmdlet helps you get the information about replication failure for a specified server, site, domain, or Active Directory forest. For example, to get the replication status for a specific domain controller, failure counts, last error, and the replication partner it failed to replicate with, execute the command below: Get-ADReplicationFailure DC1.mydomain.local You can also set the scope to see the replication status for all domain controllers in a specific site. As an example, the below command r...