Create Distribution Group(s) with CSV and PowerShell

To create Distribution Groups in Office 365/Exchange Online I’ve created a script which uses a CSV file for input. The file must be saved as “Unicode, Semicolon separated” (;) and must contain the following fields:

Name Description
Name Name of the Shared Mailbox (this field cannot contain spaces!)
Display Name Full / Display Name
Email Primary email address (this field can contain only one address)
Alias Email alias address(es) – when using more than one: separate them by using a comma (,)
Members Specify the primary email addresses for users who will have access to this mailbox – separate them by using a comma (,)
Hidden Hide or show the Distribution Group in the Global Address List with this field (= required).It can contain only two values: TRUE or FALSE

Make sure that you give the right people (normally the IT department) owner rights for the Distribution Group(s). Because only owners can add members to a group. You need to specify the primary email addresses for the owners in the PowerShell script! Separate the email addresses by using a comma (,).

Script

Here’s the code for the script:

#### Set Variable
Set-Variable -name DGOwners -value admin@wortelltechready.com,user1@wortelltechready.com

#### Create Function Logon to Office365 - Exchange Online
function Logon {
    #### Pop-up a dialog for username and request your password
    $cred = Get-Credential
    #### Import the Local Microsoft Online PowerShell Module Cmdlets and Connect to O365 Online
    Import-Module MSOnline
    Connect-MsolService -Credential $cred
    #### Establish an Remote PowerShell Session to Exchange Online
    $msoExchangeURL = “https://ps.outlook.com/powershell/”
    $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $session
                }

#### Create Function Logoff Office365 & Exchange Online
function Logoff {
    #### Remove the Remote PowerShell Session to Exchange Online ----
    Get-PsSession | Remove-PsSession
    #Remove-PsSession $session
                }

############################################################################################################################
############################################################################################################################

#### Logon to Office 365 & Exchange Online
Logon

#### Ask the user for input CSV File
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$ofd = New-Object System.Windows.Forms.OpenFileDialog
#$ofd.InitialDirectory = "d:scripts"
$ofd.ShowHelp=$true
if($ofd.ShowDialog() -eq "OK") { $ofd.FileName }
$File = $ofd.Filename

#### Create Log File + Start Logging
if ($File -ne $Null) {
$Log = $File + ".log"
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path $Log -append
   }

#### Import CSV
Import-csv -Delimiter ";" $File | ForEach {

#### Create DistributionGroup
New-DistributionGroup -Name $_."Name" -Alias $_."Name" -DisplayName $_."Display Name" -PrimarySmtpAddress $_."Email" -Type Distribution

#### Add Aliases
$Aliases = $_.Alias -split ','
if ($Aliases -ne $Null) {
Set-DistributionGroup -Identity $_."Name" -EmailAddresses @{add= $Aliases}
   }

#### Hide or show the DistributionGroup in the Global Address List
if ($_.Hidden) {
[boolean] $StoreBool = [System.Convert]::ToBoolean($_."Hidden")
Set-DistributionGroup -Identity $_."Name" -HiddenFromAddressListsEnabled $StoreBool
    }

#### Add Members
$Name = $_."Name"
$Member = $_.Members -split ","
$Member | Foreach-object {
Add-DistributionGroupMember -Identity $Name -Member $_
   }

#### Set Owners
Set-DistributionGroup $_."Name" -BypassSecurityGroupManagerCheck -ManagedBy $DGOwners

}

#### Stop Logging
Stop-Transcript

#### Logoff
Logoff

Copy and paste the code in notepad (for example) and save it as “CreateDistributionGorup.ps1”. Go through the following steps to use the script.

Steps

Other options you can use with a Distribution Group like Moderation, will have the default values. These can be set separately by using the web interface or with PowerShell.

This is part 4 of a series of posts about some PowerShell scripts I created or used and modified for some Office 365/Exchange Online migrations.

In part 5 of this series I will share a script which can be used to create External Contacts.

An overview of the series can be found here.

0  

Issue: Windows Server 2012 Virtual Machines can only be backed up using saved state

I recently came across an issue in an environment where we used DPM 2012 SP1 to backup Windows Server 2012 Virtual Machines running on Server 2008R2 Hyper-V cluster. The only option available in DPM for the VM’s was “Backup Using Saved State”.

Of course this is not the preferred method for backing up a VM because it will be put in a saved state during backup causing the VM to be offline for that period of time. I’d like to use the online backup option: “Backup Using Child Partition Snapshot”.

After some digging I found a forum post which had a reply from a Microsoft employee that suggested to create the following registry key:
HKLMSoftwareMicrosoftWindows NTCurrentVersionSystemRestore
REG_DWORD ScopeSnapshots 0x0

After implementing the registry key on all of the Windows Server 2012 VM’s I could backup using a child partition snapshot without any problems.

It seems that the Hyper-V integration components need a new feature in Windows Server 2012 (and Windows 8) called scoped VSS snapshots to be turned off in order to support online backups. This feature is enabled by default.

I also found some reports about Windows Server 2012 guests transferring the whole VM during backups instead on block level changes. Implement the registry key on every VM that is Windows 8 or Windows Server 2012 to resolve both of these issue.

0  

Convert Shared Mailbox(es) to Regular in Office 365 / Exchange Online

To convert Shared Mailbox(es) to Regular Mailbox(es) in Office 365/Exchange Online I’ve created a script with which we can either can use a CSV file for input or fill in the boxes when the script asks for input. Use a CSV when converting several mailboxes at one time. Use the manual form for 1 mailbox.
When using a CSV-file, it must be saved as “Unicode, Semicolon separated” (;) and must contain the following fields:

Name Description
Email Primary email address for the Shared Mailbox
License Name of the license which will be attached (in the form of “TenantId:AccountSkuId”

Make sure you fill in the right license in the License field within the CSV and that these licenses are purchased/ available! For example:

Name Powershell
P1 tenant:EXCHANGESTANDARD
P2 tenant:EXCHANGEENTERPRISE
K tenant:EXCHANGEDESKLESS

Script

Here’s the code for the script:


#### Set Variable
Set-Variable -name UsageLocation -value NL
#### Create Function Logon to Office365 - Exchange Online
function Logon {
 #### Pop-up a dialog for username and request your password
 $cred = Get-Credential
 #### Import the Local Microsoft Online PowerShell Module Cmdlets and Connect to O365 Online
 Import-Module MSOnline
 Connect-MsolService -Credential $cred
 #### Establish an Remote PowerShell Session to Exchange Online
 $msoExchangeURL = “https://ps.outlook.com/powershell/”
 $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
 Import-PSSession $session
 }

#### Create Function Logoff Office365 & Exchange Online
function Logoff {
 #### Remove the Remote PowerShell Session to Exchange Online ----
 Get-PsSession | Remove-PsSession
 #Remove-PsSession $session
 }

#### Create Function Create Dropbox
Function Select-DropObject ($ObjName, $Object) {
 #Generated Form Function
 function GenerateForm {
 #region Import the Assemblies
 [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
 [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
 #endregion
 #region Generated Form Objects
 $form1 = New-Object System.Windows.Forms.Form
 $button1 = New-Object System.Windows.Forms.Button
 $label1 = New-Object System.Windows.Forms.Label
 $comboBox1 = New-Object System.Windows.Forms.ComboBox
 $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
 #endregion Generated Form Objects

#----------------------------------------------
 #Generated Event Script Blocks
 #----------------------------------------------
 #Provide Custom Code for events specified in PrimalForms.
 $button1_OnClick=
 {
 $global:SelObj = $comboBox1.SelectedItem
 $form1.close()
 }
 $handler_label2_Click=
 {
 }
 $OnLoadForm_StateCorrection=
 {#Correct the initial state of the form to prevent the .Net maximized form issue
 $form1.WindowState = $InitialFormWindowState
 $Object | Foreach {
 $comboBox1.items.add($_)
 $comboBox1.SelectedIndex=0
 }
 $Combobox1.visible = $true
 $label1.visible = $true
 $button1.visible = $true
 $form1.Text = "Please select a $ObjName"
 }
 #----------------------------------------------
 #region Generated Form Code
 $form1.AutoScaleMode = 0
 $form1.Text = "Please wait loading $ObjName...."
 $form1.Name = "form1"
 $form1.DataBindings.DefaultDataSourceUpdateMode = 0
 $System_Drawing_Size = New-Object System.Drawing.Size
 $System_Drawing_Size.Height = 66
 $System_Drawing_Size.Width = 392
 $form1.ClientSize = $System_Drawing_Size
 $form1.FormBorderStyle = 1
 $form1.Controls.Add($InfoLabel)
 $button1.TabIndex = 2
 $System_Drawing_Size = New-Object System.Drawing.Size
 $System_Drawing_Size.Height = 23
 $System_Drawing_Size.Width = 75
 $button1.Size = $System_Drawing_Size
 $button1.Name = "button1"
 $button1.UseVisualStyleBackColor = $True
 $button1.Visible = $False
 $button1.Text = "OK"
 $System_Drawing_Point = New-Object System.Drawing.Point
 $System_Drawing_Point.X = 300
 $System_Drawing_Point.Y = 21
 $button1.Location = $System_Drawing_Point
 $button1.DataBindings.DefaultDataSourceUpdateMode = 0
 $button1.add_Click($button1_OnClick)
 $form1.Controls.Add($button1)
 $label1.TabIndex = 1
 $label1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,1,3,1)
 $System_Drawing_Size = New-Object System.Drawing.Size
 $System_Drawing_Size.Height = 23
 $System_Drawing_Size.Width = 50
 $label1.Size = $System_Drawing_Size
 $label1.Name = "label1"
 $label1.Visible = $False
 $label1.Text = "$ObjName:"
 $System_Drawing_Point = New-Object System.Drawing.Point
 $System_Drawing_Point.X = 8
 $System_Drawing_Point.Y = 26
 $label1.Location = $System_Drawing_Point
 $label1.DataBindings.DefaultDataSourceUpdateMode = 0
 $form1.Controls.Add($label1)
 $System_Drawing_Point = New-Object System.Drawing.Point
 $System_Drawing_Point.X = 64
 $System_Drawing_Point.Y = 21
 $comboBox1.Location = $System_Drawing_Point
 $comboBox1.Visible = $False
 $comboBox1.DataBindings.DefaultDataSourceUpdateMode = 0
 $comboBox1.FormattingEnabled = $True
 $comboBox1.Name = "comboBox1"
 $comboBox1.TabIndex = 0
 $System_Drawing_Size = New-Object System.Drawing.Size
 $System_Drawing_Size.Height = 21
 $System_Drawing_Size.Width = 217
 $comboBox1.Size = $System_Drawing_Size
 $form1.Controls.Add($comboBox1)
 #endregion Generated Form Code
 #Save the initial state of the form
 $InitialFormWindowState = $form1.WindowState
 #Init the OnLoad event to correct the initial state of the form
 $form1.add_Load($OnLoadForm_StateCorrection)
 #Show the Form
 $form1.StartPosition = "CenterScreen"
 $form1.ShowDialog()| Out-Null
 } #End Function
 #Call the Function
 GenerateForm
 }

 

############################################################################################################################
############################################################################################################################

#### Logon to Office 365 & Exchange Online
Logon
#### Ask the user for input Use CSV?
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$result = [Microsoft.VisualBasic.Interaction]::MsgBox(`
"Do you want to convert using a CSV file?", 'YesNoCancel,Question', "Respond please")

switch ($result) {
 'Yes' {
 #### Give CSV Name
 #$file = [Microsoft.VisualBasic.Interaction]::InputBox("Enter CSV File including full path", "CSV File", "")
 [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
 $ofd = New-Object System.Windows.Forms.OpenFileDialog
 #$ofd.InitialDirectory = "d:scripts"
 $ofd.ShowHelp=$true
 if($ofd.ShowDialog() -eq "OK") { $ofd.FileName }
 $File = $ofd.Filename
 Write-Host $File

 #### Create Log File + Start Logging
 if ($File) {
 $Log = $File + ".log"
 $ErrorActionPreference="SilentlyContinue"
 Stop-Transcript | out-null
 $ErrorActionPreference = "Continue"
 Start-Transcript -path $Log -append
 }

 #### Convert Shared Mailbox
 Import-csv -Delimiter ";" $File | ForEach {
 Set-MsolUser -UserPrincipalName $_."Email" -UsageLocation $UsageLocation
 Set-MsolUserLicense -UserPrincipalName $_."Email" -AddLicenses $_."License"
 Set-Mailbox $_."Email" -Type Regular -ProhibitSendReceiveQuota 25GB -ProhibitSendQuota 24.75GB -IssueWarningQuota 24.5GB
 }

#### Stop Logging
 Stop-Transcript

 }

'No' {

#### Create Log File + Start Logging
 $Log = "ConvertSharedMailboxToRegular.ps1.log"
 $ErrorActionPreference="SilentlyContinue"
 Stop-Transcript | out-null
 $ErrorActionPreference = "Continue"
 Start-Transcript -path $Log -append

#### Ask for selecting UserPrincipalName
 #$Name = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the User Princicpal Name (primary mail address)", "UPN", "")
 Write-Host "Please wait while the list of mailboxes is being generated!" -BackgroundColor DarkGreen -ForegroundColor White
 Select-DropObject "Mailbox" (Get-Mailbox -ResultSize Unlimited | Where { $_.RecipientTypeDetails -eq 'SharedMailbox' } | Sort -property UserPrincipalName | Select @{Name = "Name"; Expression = {$_.UserPrincipalName}} | Foreach-Object {$_ -replace "@{Name=", ""} | Foreach-Object {$_ -replace "}", ""} )
 $Name = $SelObj

 #### Select License
 # Send the Licenses to the License function
 Select-DropObject "License" (Get-MsolAccountSku | Select @{Name = "License"; Expression = {$_.AccountSkuId}}| Foreach-Object {$_ -replace "@{License=", ""} | Foreach-Object {$_ -replace "}", ""})
 $License = $SelObj

 #### Convert Shared Mailbox
 Set-MsolUser -UserPrincipalName $Name -UsageLocation $UsageLocation
 Set-MsolUserLicense -UserPrincipalName $Name -AddLicenses $License
 Set-Mailbox $Name -Type Regular -ProhibitSendReceiveQuota 25GB -ProhibitSendQuota 24.75GB -IssueWarningQuota 24.5GB

#### Stop Logging
 Stop-Transcript

}

 
 'Cancel' { "The process is cancelled" }
}

#### Logoff
Logoff

Copy and paste the code in notepad (for example) and save it as “ConvertSharedMailboxToRegular.ps1”. Go through the following steps to use the script.

Steps

This is part 3 of a series of posts about some PowerShell scripts I created or used and modified for some Office 365/Exchange Online migrations.

In part 4 of this series I will share a script which can be used to create Distribution Groups.

An overview of the series can be found here.

0  

Create Shared Mailboxes with CSV and PowerShell

For the purpose of creating Shared Mailboxes in Office 365/Exchange Online I created a PowerShell script which uses a CSV file for input. The file must be saved as “Unicode, Semicolon separated” (;) and must contain the following fields:

Name Description
Name Name of the Shared Mailbox (this field cannot contain spaces!)
Display Name Full / Display Name
Email Primary email address (this field can contain only one address)
Alias Email alias address(es) – when using more than one: separate them by using a comma (,)
Members Specify the primary email addresses for users who will have access to this mailbox – separate them by using a comma (,)

During the process of creating Shared Mailbox(es) the script creates a security enabled Distribution Group with the name SG_”SharedMailbox Name”. This Distribution Group is given full access to the mailbox. So when a user needs access to the group they only have to be a member of the Distribution Group. Make sure that you give the right people (normally the IT department) owner rights for this Distribution Group. Because only owners can add members to the group. You need to specify the primary email addresses for the owners in the PowerShell script! Separate the email addresses by using a comma (,)

Script

Here’s the code for the script:

#### Set Variable
Set-Variable -name Domain -value wortelltechready.com
Set-Variable -name DGOwners -value admin@wortelltechready.com,user1@wortelltechready.com
#### Create Function Logon to Office365 - Exchange Online
function Logon {
 #### Pop-up a dialog for username and request your password
 $cred = Get-Credential
 #### Import the Local Microsoft Online PowerShell Module Cmdlets and Connect to O365 Online
 Import-Module MSOnline
 Connect-MsolService -Credential $cred
 #### Establish an Remote PowerShell Session to Exchange Online
 $msoExchangeURL = “https://ps.outlook.com/powershell/”
 $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
 Import-PSSession $session
 }

#### Create Function Logoff Office365 & Exchange Online
function Logoff {
 #### Remove the Remote PowerShell Session to Exchange Online ----
 Get-PsSession | Remove-PsSession
 #Remove-PsSession $session
 }

############################################################################################################################
############################################################################################################################

#### Logon to Office 365 & Exchange Online
Logon
#### Ask the user for input CSV File
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$ofd = New-Object System.Windows.Forms.OpenFileDialog
#$ofd.InitialDirectory = "d:scripts"
$ofd.ShowHelp=$true
if($ofd.ShowDialog() -eq "OK") { $ofd.FileName }
$File = $ofd.Filename

#### Create Log File + Start Logging
if ($File -ne $Null) {
$Log = $File + ".log"
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path $Log -append
 }

#### Import CSV
Import-csv -Delimiter ";" $File | ForEach {

#### Create Mailbox
New-Mailbox -Name $_."Name" -DisplayName $_."Display Name" -PrimarySmtpAddress $_."Email" -Shared

#### Set Mailbox Size for Shared Mailboxes
Set-Mailbox $_."Name" -ProhibitSendReceiveQuota 5GB -ProhibitSendQuota 4.75GB -IssueWarningQuota 4.5GB -MicrosoftOnlineServicesID $_."Email"

#### Add Aliases
$Aliases = $_.Alias -split ','
if ($Aliases -ne $Null) {
 Set-Mailbox $_."Name" -EmailAddresses @{add= $Aliases}
 }

#### Create Security Group with name SG_"Distribution Group Name", add Members and set Owners
$Name=$_."Name"
$DGName="SG_" + $Name
$DGMail=$DGName + "@" + $Domain
New-DistributionGroup -Name $DGName -Type Security -PrimarySmtpAddress $DGMail
$Member = $_.Members -split ","
$Member | Foreach-object {
Add-DistributionGroupMember -Identity $DGName -Member $_
 }
Set-DistributionGroup $DGName -HiddenFromAddressListsEnabled $true
Set-DistributionGroup $DGName -BypassSecurityGroupManagerCheck -ManagedBy $DGOwners
#### Add permissions for Distribution Group
Add-MailboxPermission $Name -User $DGName -AccessRights FullAccess
Add-RecipientPermission $Name -Trustee $DGName -AccessRights SendAs -Confirm:$False

 

}
#### Stop Logging
Stop-Transcript
#### Logoff
Logoff

Copy and paste the code in notepad (for example) and save it as “CreateSharedMailbox.ps1”. Go through the following steps to use the script.

Steps

This is part 2 of a series of posts about some PowerShell scripts I created or used and modified for some Office 365/Exchange Online migrations.

In part 3 of this series I will share a script which can be used to convert Shared Mailbox(es) to Regular Mailbox(es).

An overview of the series can be found here.

0  

Office 365 / Exchange Online PowerShell Scripts – part 1

At my first real confrontation with Office 365 and Exchange Online (about 7 months ago) I was really surprised by the fact that there are so little complete PowerShell scripts out there.

So with the help of my basic PowerShell knowledge (at that time) and my favorite search engine (no names here J) I build some scripts that we used for some big migrations to Office 365/Exchange Online.

This is the first post in a series where I will discuss every script I created or used and modified in a separate post.

In this fist post I’d like to share a way to create a function and adding it to your PowerShell profile so that you can quickly execute the function from any open PowerShell session when you need it.
I came across the following post from Thomas Ashworth: http://blogs.technet.com/b/thomas_ashworth/archive/2012/04/11/connect-to-office-365-via-remote-powershell.aspx and added a section for connecting to Office 365 in one command. So the information in this post is based on the post of Thomas.

Start by creating a PowerShell profile if you do not already have one. The following one liner will create an empty PowerShell profile.

New-item $profile –itemtype file –force

Next open the profile file in Notepad. This step is easily performed from PowerShell using the following command.

notepad $profile

Copy and paste the following function into the profile, save the file, and restart PowerShell (or reload the profile).

Function Connect-ExchangeOnline
{

[CmdletBinding()]

param

(

[Parameter(Mandatory = $False)]

[System.Management.Automation.PsCredential]$Credential = $Host.UI.PromptForCredential(“Enter MSOL Admin Credential”,

“Enter the username and password of an MSOnline Administrator account.”,

“”,

“userCreds”),

[Parameter(Mandatory = $False)]

[System.Uri]$Uri = “https://ps.outlook.com/powershell/”

)

Import-Module MSOnline

        Connect-MsolService -Credential $Credential

        $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $Uri -Credential $Credential -Authentication “Basic” -AllowRedirection

Import-PSSession $session -AllowClobber

Return $session

}

From now on whenever you need to connect to Office 365 and/or run Exchange cmdlets, you can simply type “Connect-ExchangeOnline” directly at the PowerShell prompt.

In part 2 of this series I’ll share a script which creates Shared Mailboxes + security group and adds the appropriate members.

0  

Database Auto-Protection Failed DPM

This error occurs when WMI is not properly working on Protected SQL servers. You can check on which server this occurs by running the AutoProtectInstances.ps1 Powershell script in the DPM Management Shell. What this script does is checking for new SQL instances that are added to your protected SQL Servers.

Error Database Auto-Protection Failed

 

The Powershell script will try to connect to the SQL server which protected by a Protection Group.
In the screenshot you see the servername. Error AutoProtectInstances

You can check if WMI is properly working by following the steps below:

  • Run WBEMTEST.exe
  • Click Connect and  connect to: \\<SQL SERVER>\root\Microsoft\sqlserver\computermanagement10
  • Query using the following WQL query: SELECT * From ServerSettings
    If that class is missing, this query will fail with the error number: 0x80041010 and Description: Invalid Class.

If you get the error above you can resolve it by logging in to the SQL Server and running the following command:

  • mofcomp “C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof”

This will register the right WMI classes.

When you go back to your DPM Management Console the error will be gone automatically.

0  

Remove a Old SCVMM Integration with SCOM

In our LAB i created a SCOM 2012 inegration with SCVMM 2012. After the expiration off the trial period of SCVMM we installed SCVMM on a other server.
The old intergration with SCOM wasn’t deleted. So how can you delete the old integration.

– Open SQL Management Studio on your SCOM Server.
– Make a query on the OperationManager Database

select DisplayName,IsInitialized,ConnectorID from Connector,BaseManagedEntity 
where Connector.BaseManagedEntityID=BaseManagedEntity.BaseManagedEntityID

This query result returns 3 columns: DisplayName,IsInitialized,ConnectorID

Uninitialize a Connector
If the connector you want to delete is Initialized you must Unitialize it.
If a connector is Initialized the value is 1. Else you can go on to the delete section.

EXEC p_ConnectorUpdate 'YOURCONNECTORID',NULL,0

Delete the Connector
If the connector is not initialized you can savely delete the connector.

EXEC p_ConnectorDelete 'YOURCONNECTORID',NULL,NULL

Remove the connection from SCVMM
Open Virtual Machine Manager Command Shell and run the following command.

get-vmmserver "VMMSERVERNAME" | Remove-SCOpsMgrConnection -force
0  

Install Win7 SP1 with additional LP using MDT2010 without Errors

To install Windows 7 SP1 with additional language packs using MDT2010 you need to update WinPE to version 3.1 and you need to edit a script in your deploymentshare. When you not do this things you get Error: Windows could not apply unattend settings during pass [offlineServicing].
Step 3:
Unpack the WAIK SP1 iso and copy the tools to update the WinPE to version 3.1.
You can use the following xcopy command to copy it.

xcopy "unpacked iso" "C:\Program Files\Windows AIK\Tools\PETools" /ERDY
The following link is the “Windows Automated Installation Kit for Windows 7 Readme” from Microsoft:
http://technet.microsoft.com/en-us/library/dd349350(WS.10).aspx#Win7SP1
Step 4:
Open %deploymentshare%\scripts\DeployWiz_Initialization.vbs
go to line 1101 and add the word ‘Refresh’.

LPQuery = “PackageType = ‘LanguagePack’ and ProductName = ‘Microsoft-Windows-Client-Refresh-LanguagePack-Package’ and substring(ProductVersion,1,7) = ‘” & left(ImgBuild,7) & “‘ and substring(ProductVersion,5,4) >= ‘” & mid(ImgBuild,5,4) & “‘”

The reson why you need to edit the script is that in the package.xml from the langagepack is looking for “productname = ‘Microsoft-Windows-ClientLanguagePack-Package’ ” without the word Refresh
When you now start the deploymentwizard you can choose the additional languagepack and the installation will continue without any problem.
0