Posts Tagged "Powershell"

How to install all roles and features of one server on another

Posted by on Jun 13, 2017 in Powershell, Roles and Features | 0 comments

Ever wanted to install all the roles and features that are installed on one server on another server? Easy. Just copy and paste the following command into an elevated powershell on the server where the roles and features are installed. Then copy the output and paste it into an elevated powershell on the other server: Get-WindowsFeature | ? { $_.Installed } | Select Name | ForEach-Object { "Install-WindowsFeature $($_.Name)"...

Read More

Check objectVersion on all Domain Controllers after schema update with PowerShell

Posted by on Feb 2, 2013 in Active Directory, Powershell | 1 comment

Check objectVersion on all Domain Controllers after schema update with PowerShell

Just copy and paste into PowerShell (Active Directory Module for Windows PowerShell) to get the version of AD schema on all domain controllers in current domain: $schemaContext = Get-ADRootDSE | %{$_.schemaNamingContext} Foreach ($dc in ([System.DirectoryServices.ActiveDirectory.DomainController]::findall( (new-object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain",$env:USERDNSDOMAIN)))) | %{$_.name}) { $path = 'LDAP://' + $dc + '/' + $schemaContext $Object = [adsi]$path $dc + ' ' + $Object.objectversion...

Read More

How to get a list of all tapes a System Center DPM Server knows about?

Posted by on Nov 15, 2012 in Data Protection Manager, Powershell | 1 comment

How to get a list of all tapes a System Center DPM Server knows about?

I have a long list of DPM tapes – a very long list… and most of them are offline. But how would you know what data is stored on what tape? Jeff Wouters wrote a blogpost about it at http://jeffwouters.nl/index.php/2012/04/list-all-tapes-in-dpm-with-a-powershell-oneliner/ He put the list of tapes in a text file using Get-ProtectionGroup –DPMServer DPM001 | get-tape | select barcode | sort | out-file E:\Temp\DPMTapeBarcodeList.txt I prefer to have a quick overview in powershell itself by using gc env:computername | Get-ProtectionGroup | get-tape | fl This will list all tapes known...

Read More

Restore deleted computer object including BitLocker recovery information

Posted by on Aug 10, 2012 in Active Directory, BitLocker, Powershell | 6 comments

Recovery of Active Directory objects became much easier with the introduction of AD recycle bin feature in Windows Server 2008 R2. Simply use the restore-adobject PowerShell cmdlet and you’re done. But what if you are using BitLocker with its keys stored in AD? You can still restore the computer object once it got deleted. But the attached msFVE-RecoveryInformation objects will not get restored automatically. This small PowerShell cmdlet will do the work for you: import-module ActiveDirectory function RestoreComputer($computername) { If ($computername.substring($computername.length -...

Read More

How to get the number of volumes used by DPM 2010?

Posted by on Apr 16, 2012 in Data Protection Manager, Powershell | 0 comments

Just a quick hit that tells you how many volumes Microsoft Data Protection Manager uses. I got 848… $dpmserver = $env:computername #localhost or type your dpm server's name here $dpmdisks = get-dpmdisk -dpmservername $dpmserver $volumecount = 0 $dpmdisks | ForEach-Object { $volumecount += $_.VolumeCount } $volumecount

Read More