Hoppa till innehåll

  • Logga in via Facebook Logga in via Twitter Logga in via Windows Live Log In with LinkedIn Log In with Google      Sign In   
  • Registrera dig nu!





Foto

Working in the Datacenter – Deploying the DPM agent using PowerShell

  Skriven av Mikael Nystrom , 10 March 2016 · 1705 visningar

Last night i was deploying a DPM server for a customer and we needed to deploy the DPM agent on a few machines. It is well know that DPM can do push agent install, but the requirements is to open high ports on every client, well lets state that it is not something any customer likes to do, so that means that we will use the Attach Agent function in DPM and that require the agent to be installed first.
The trick is not to install it, rather running the setDpmServer command that will do a connection against the DPM server, resulting in the double hop issue in Windows. The real solution is to use the existing software deployment solution to push the agent or to install the agent when the server is deployed, but in this case we needed a quick-and-dirty method to get it out to a few servers.
So the script will copy the installers to the target, install the agent, configure the agent and add the agent to the DPM server. It works with multiple servers at the same time. It uses CredSSP to fix the double-hop issue, which was ok for this customer.
The Script


Param(
    $Servers,
    $UserName,
    $Password,
    $DMPServerName
)

$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
$User = “$env:USERDOMAIN$UserName”
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $User, $SecurePassword

Foreach($Server in $Servers){
    Enable-WSManCredSSP -Role Client -Force -DelegateComputer $Server
    New-Item -Path "\$Serverc$DPMinstall" -ItemType Directory -Force
    Copy-Item -Path 'C:Program FilesMicrosoft System Center 2012 R2DPMDPMProtectionAgentsRA4.2.1205.0amd64' -Destination "\$Serverc$DPMinstall" -Container -Force -Recurse
    Invoke-Command -ComputerName $Server -ScriptBlock {
        Enable-WSManCredSSP -Role Server -Force
        cmd.exe /c C:DPMInstallamd64DPMAgentInstaller_x64.exe /q /IAcceptEula
        & 'C:Program FilesMicrosoft Data Protection ManagerDPMbinSetDpmServer.exe' -dpmServerName $DMPServerName
    } -EnableNetworkAccess -Credential $Credentials -Authentication Credssp
    & 'C:Program FilesMicrosoft System Center 2012 R2DPMDPMbinAttach-ProductionServer.ps1' -DPMServerName "$DMPServerName.$env:USERDNSDOMAIN" -UserName $UserName -Password $Password -Domain $env:USERDOMAIN -PSName $Server
}


/mike
  http://feeds.wordpress.com/1.0/comments/anothermike2.wordpress.com/2398/ Postad bild

Källa