Check Hyper-V replication status using Powershell

One of my colleges sent me this little snippet today for easily checking replication status on the VMs on our hyper-v host… I modified it for checking multiple hosts:

Get-VMReplication -computername HOST1,HOST2,HOST3 | select-object lastreplicationtime, vmname, computername | Sort-Object -Property LastReplicationTime | ft -AutoSize

/Johan

How to monitor Windows 2008 R2 Servers from Server Manager in Windows Server 2012

This will be a very short and sweet description on how to monitor Windows Server 2008 R2 from Windows Server 2012

  1. Start by installing .NET 4 Framework on the 2008 R2 Server
  2. Install Windows Management Framework 3.0 in the 2008 R2 server
  3. Run winrm qc in an elevated command prompt on the Windows Server 2008 R2 computer
  4. To be able to use BPA on the 2008 R2 server run Enable-PSremoting –Force from an elevated PowerShell prompt
  5. Done…

Force update of Exchange 2010 address lists

If you add a new mailbox or a distribution list to your Exchange 2010 server you need to either wait for the address lists to update you can force them to update.

In the Exchange management prompt run:

Get-GlobalAddressList | update-GlobalAddressList
Get-AddressList | update-AddressList
Get-OfflineAddressBook | Update-OfflineAddressBook

On the Clients you might need to update the Offline Address Book by going to Send/Receive – Send/Receive Groups – Download Address Book…

/Johan

Adding and removing the GUI in Windows Server 2012

In Windows Server 2008 R2 you could select whether you wanted to run Standard (GUI) och Core version of Windows Server. In Windows Server 2012 the GUI is a feature which you can add or remove.

To remove the GUI you use the following Powershell one-liner:

Remove-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra

You can also uninstall the GUI, which removes the binary files from the disk. To completely uninstall the GUI you use the following Powershell one-liner:

Uninstall-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra

If you realize you are in over your head you can add it back in using:

Add-WindowsFeature Server-Gui-Shell

… or:

Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source c:\mountdir\windows\winsxs

You can also do all of this using Dism:
Dism /online /enable-feature /featurename:ServerCore-FullServer /featurename:Server-Gui-Shell /featurename:Server-Gui-Mgmt

Links

http://technet.microsoft.com/library/hh831786

TrueSec on The Scripting Guys

As you might know Microsoft has a site called The Scripting Guys. My colleague Niclas Goude will be writing a couple of guest blogs on The Scripting Guys regarding security from the 2:nd to the 6:th of July.

The specific subjects will be:

Monday: Scanning
Tuesday: Brute Force
Wednesday: Shares and Metadata
Thursday: Give yourself System Permission without psexec
Friday: LSA Secrets

Sessions, Sessions, Sessions…

I did not have the possibility to visit eighter MMS or TechED North America this year but fortunately Microsoft makes all the sessions available for download. The problem is that it takes a lot of time to download the ones I want. So I tried to find a better way to do it and someone has written a script Smile

In the links below you will find the two scripts.

Links

http://blog.scomfaq.ch/2012/04/21/mms-2012-download-sessions-offline-viewing/

http://blog.scomfaq.ch/2012/06/13/teched-2012-orlando-download-sessions-offline-viewing/

Hosted Exchange 2010 SP1

Håller just nu på att installera en Hosted Exchange 2010 lösning hos en kund och tänkte att jag skulle samla lite resurser och skriva ner lite instruktioner:

Powershell Snippets

Skapa en organisation

   1: Password = Read-Host "Enter Password" -AsSecureString

   2: New-organization -name TestOrg -DomainName TestOrg.com -ProgramId HostingSample -OfferId 2 -location sv-SE -AdministratorPassword $Password

Radera alla mailboxar i en organisation

   1: get-mailbox -Organization TestOrg | remove-mailbox

Radera Organisation

   1: Remove-Organization TestOrg

Skapa användare i Organisation

   1: $OrgName = TestORG

   2: Import-CSV CreateRecipients.csv | foreach {new-mailbox $_.name -userPrincipalName $_.UPN -org $OrgName -Password (ConvertTo-SecureString $_.password -AsPlainText -Force)}

Vi läser filen CreateRecipients.csv och skapar användare i Organisationen. CreateRecipients.csv skall se ut så här:

   1: Name,UPN,Password

   2: Nisse Hult,nisse.hult@testorg.com,P@ssw0rd1

   3: Kalle Kula,kalle.kula@testorg.com,P@ssw0rd2

Lägg till mailadresser för en användare

   1: $user = Get-Mailbox -identity $args[0] -organization TestOrg

   2: $CLIARGS=$args[1..($args.length - 1)]

   3: ForEach ($CLIARG in $CLIARGS)

   4: {

   5: $user.emailAddresses+=$CLIARG

   6: }

   7: Set-Mailbox $user -emailAddresses $user.emailAddresses

Detta script lägger till extra mailadresser för en användare. Spara scriptet som AddEmail.ps1 och kör det enligt följande:

AddEmail.ps1 [primary email] [extra email 1] [extra email 2]…

Länkar:

http://www.zerohoursleep.com/2010/10/step-by-step-starting-with-exchange-2010-sp1-multi-tenant-installation/
http://www.zerohoursleep.com/2010/10/step-by-step-starting-with-exchange-2010-sp1-multi-tenant-create-and-delete-organizations/
http://www.zerohoursleep.com/2010/10/step-by-step-starting-with-exchange-2010-sp1-multi-tenant-manage-your-organizations/
http://www.zerohoursleep.com/2010/10/step-by-step-starting-with-exchange-2010-sp1-multi-tenant-sending-and-receiving-emails/
http://www.yusufozturk.info/exchange-server/creating-a-new-mailbox-with-powershell-function-on-exchange-server-2010.html
http://www.yusufozturk.info/exchange-server/creating-a-new-mailbox-with-powershell-function-on-exchange-server-2010.html

Microsoft Exchange Server 2007 – Public Folders

Some powershell stuff on managing Public Folders in Exchange 2007

Create Public Folder

   New-PublicFolder -name "Name"

Remove a Public Folder

   Remove-PublicFolder -Identity "My Public Folder"

Get information on Public Folders

   Get-PublicFolder or Get-PublicFolder -Identity ""

Get information on all public folders

   Get-PublicFolder -Recurse | Format-List Name

get info on all system folders (not otherwise visible)

   Get-PublicFolder -Identity NON_IPM_SUBTREE -Recurse | Format-List Name 

What I need to find out:

– I could not find how to create a Contacts och Calendar Folder
– I could not find out how to change permissions on the root of the Public Folder tree
– I could not change the permission on the public folders

Links:

http://technet.microsoft.com/en-us/library/bb124411.aspx
http://www.msexchange.org/tutorials/MF018.html