让LYNC安装更容易些

在Windows Server 2008 R2上安装LYNC以前,根据安装组件的不一样,咱们须要安装不少必要的组件,手工安装这些组件仍是比较麻烦的。若是有像下面截图同样方便的工具来帮助咱们进行安装的话就是在太方便了。web

 

p_w_picpath

 

经过上面的截图,咱们看到能够根据不一样的角色来进行安装,还能够安装一些压力测试工具,RT工具,连禁用IPv6均可以。让那些复杂的添加组件操做都成为浮云吧。redis

这个至关给力的脚本就是来自于MVP  Hansen, MVP Pat Richard Marjus Sirvinsks 的通力协做。shell

原文地址:http://msunified.net/lyncdownloads/script-set-lync2010windows2008r2features-ps1/windows

如下是脚本内容:app

####################################################################################
# Set-Lync2010Windows2008R2Features.ps1
# Configures Windows Features to install Lync Server 2010
# on a Windows Server 2008 R2 Server
#
# v03 February2011 by Hansen (http://msunified.net)
# v04 04-06-2011 by Pat Richard (http://exchangeblogs.com)
#
# Thanks to
# Marjus Sirvinsks (http://marjuss.wordpress.com/) for adapting the script for OCS and Lync
# The Script is almost entirely based on Pat Richard, Bhargav Shukla and Anderson Patricio's script designed for Exchange 2010
# check it out here: http://msunified.net/exchange-downloads/script-exchange2010prereqs-ps1/
#
# future: Lync Server 2010, Stress and Performance Tool
# http://www.microsoft.com/downloads/en/details.aspx?FamilyID=94B5F191-6D80-4DEC-94C2-FCA57995F8B7&displaylang=en
####################################################################################
#Requires -Version 2.0ide

# Detect correct OS here and exit if no match (we intentionally truncate the last character to account for service packs)
if ((Get-WMIObject win32_OperatingSystem).Version -notmatch '6.1.760'){
    Write-Host "`nThis script requires a version of Windows Server 2008 R2, which this is not. Exiting...`n" -ForegroundColor Red
    Exit
}wordpress

clear-host
pushd
[string] $TargetFolder = "c:\Install"
[bool] $WasInstalled = $false
[bool] $RebootRequired = $false
# determine if BitsTransfer is already installed
if ((Get-Module BitsTransfer).installed -eq $true){[bool] $WasInstalled = $true}工具

[string] $opt = "None"
[bool] $HasInternetAccess = ([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet)
[string] $menu = @'测试

    ***************************************
    Lync Server 2010 - Prerequisites script
    ***************************************ui

    Please select an option from the list below.

    1) Front-End
    2) Director
    3) Monitoring/Archiving
    4) Communicator Web Access (OCS 2007 R2)
    5) Mediation
    6) Edge/XMPP GW
    7) GroupChat
    8) Download and install Lync Server 2010 Resource Kit
    9) Download and install Lync Server 2010 Best Practices Analyzer
    10) Download and install Lync Server 2010 Stress and Performance Tool
    11) Disable IPv6
    12) Install Telnet client
    13) Install Visual C++ 2008 Redistributable
    14) Download and install Lync 'IM an Expert' (alpha)
    15) Launch Windows Update
    98) Restart the Server
    99) Exit

Select an option.. [1-99]?
'@

function GetIt ([string]$sourcefile) {
    if ($HasInternetAccess){
        # check if BitsTransfer is installed
        if ((Get-Module BitsTransfer) -eq $null){
            Write-Host "BitsTransfer: Installing..." -NoNewLine
            Import-Module BitsTransfer
            Write-Host "Done! " -ForegroundColor Green
        }
        [string] $targetfile = $sourcefile.Substring($sourcefile.LastIndexOf("/") + 1)
        if (Test-Path $targetfolder){
            Write-Host "Folder: $targetfolder exists."
        } else{
            Write-Host "Folder: $targetfolder does not exist, creating..." -NoNewline
            New-Item $targetfolder -type Directory | Out-Null
            Write-Host "Done! " -ForegroundColor Green
        }
        if (Test-Path "$targetfolder\$targetfile"){
            Write-Host "File: $targetfile exists."
        }else{
            Write-Host "File: $targetfile does not exist, downloading..." -NoNewLine
            Start-BitsTransfer -Source "$SourceFile" -Destination "$targetfolder\$targetfile"
            Write-Host "Done! " -ForegroundColor Green
        }
    }else{
        Write-Host "Internet access not detected. Please resolve and try again." -foregroundcolor red
    }
} #end GetIt

function TelnetClient    {
    $a = New-Object -comobject wscript.shell
    $intAnswer = $a.popup("Do you want to include Telnet client?",0,"Telnet client",4)
    if ($intAnswer -eq 6) {
        #yes
        Check4SM
        if ((Get-WindowsFeature Telnet-Client).installed -eq $false){Add-WindowsFeature Telnet-Client} else {Write-Host "Telnet client already installed"}
    } else {
        #no
        # $a.popup("You answered no.")
    }
} #end TelnetClient

function DocViewer    {
    $a = new-object -comobject wscript.shell
    $intAnswer = $a.popup("Lync Resource Kit documentation is based on Microsoft Word. Would you like to install the free Word viewer?",0,"Word Viewer",4)
    if ($intAnswer -eq 6) {
        #yes
        if (!(get-item "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{90850409-6000-11D3-8CFE-0150048383C9}" -ErrorAction SilentlyContinue)){
            GetIt "http://download.microsoft.com/download/6/a/6/6a689355-b155-4fa7-ad8a-dfe150fe7ac6/wordview_en-us.exe"
            Write-Host "Installing..." -ForegroundColor Green -nonewline
            Invoke-Expression "$targetfolder\wordview_en-us.exe /q"
            Write-Host "Done!" -ForegroundColor Green
        }
        if (!(get-item "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{90120000-0020-0409-0000-0000000FF1CE}" -ErrorAction SilentlyContinue)){
            GetIt "http://download.microsoft.com/download/9/2/2/9222D67F-7630-4F49-BD26-476B51517FC1/FileFormatConverters.exe"
                Write-Host "Installing..." -ForegroundColor Green -nonewline
                Invoke-Expression "$targetfolder\FileFormatConverters.exe /q"
                Write-Host "Done!" -ForegroundColor green       
            }
    } else {
        #no
        # $a.popup("You answered no.")
    }
} #end DocViewer

function Check4SM    {
    if ((Get-Module ServerManager).installed -ne $true){Import-Module ServerManager}
} #end Check4SM

function VCRedist    {
    if (!(get-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4B6C7001-C7D6-3710-913E-5BC23FCE91E6}" -ErrorAction SilentlyContinue)){       
        GetIt "http://download.microsoft.com/download/9/7/7/977B481A-7BA6-4E30-AC40-ED51EB2028F2/vcredist_x64.exe"
        Write-Host "Installing..." -ForegroundColor Green -nonewline
        cmd.exe /c $targetfolder\vcredist_x64.exe /qb
        Write-Host "Done!" -ForegroundColor green
        # should add update from KB 2467174
    }
} #end VCRedist

function DisableIPv6    {
    Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters DisabledComponents 0xffffffff -type dword
    Write-Host "done!" -foregroundcolor green
    $RebootRequired = $true
} #end DisableIPv6

Do {
    if ($RebootRequired -eq $true){Write-Host "`t`t`t`t`t`t`t`t`t`n`t`t`t`tREBOOT REQUIRED!`t`t`t`n`t`t`t`t`t`t`t`t`t`n`t`tDO NOT INSTALL Lync BEFORE REBOOTING!`t`t`n`t`t`t`t`t`t`t`t`t" -foregroundcolor yellow}
    if ($opt -ne "None") {Write-Host "Last command: "$opt -backgroundcolor Yellow -foregroundcolor black}
    $opt = Read-Host $menu

    switch ($opt) {
        1 { Check4SM;TelnetClient;Add-WindowsFeature NET-Framework-Core,RSAT-ADDS,Web-Static-Content,Web-Default-Doc,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Http-Logging,Web-Log-Libraries,Web-Http-Tracing,Web-Windows-Auth,Web-Filtering,Web-Stat-Compression,Web-Mgmt-Console,Web-Scripting-Tools,Web-Client-Auth,Desktop-Experience; $RebootRequired = $true }
        2 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core,Web-Static-Content,Web-Default-Doc,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Http-Logging,Web-Log-Libraries,Web-Http-Tracing,Web-Windows-Auth,Web-Filtering,Web-Stat-Compression,Web-Mgmt-Console,Web-Scripting-Tools,Web-Client-Auth; $RebootRequired = $true }
        3 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core,msmq-server,msmq-directory }
        4 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core,web-server, web-http-redirect, web-asp-net, web-http-logging, web-log-libraries, web-request-monitor, web-http-tracing, web-basic-auth, web-windows-auth, web-mgmt-console, web-scripting-tools, web-mgmt-compat, was-process-model, was-net-environment, rsat-adds ; $RebootRequired = $true }
        5 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core }
        6 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core }
        7 { Check4SM;TelnetClient;Add-windowsfeature NET-Framework-Core, web-server, web-mgmt-compat, web-asp-net, msmq-server, msmq-directory, rsat-adds ; $RebootRequired = $true }
        8 {
                if (!(get-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9C44E652-CBBC-4E1C-8172-21A7D46CAB85}" -ErrorAction SilentlyContinue)){
                    GetIt "http://download.microsoft.com/download/1/8/A/18ADD884-E16F-4AD3-8422-FC80073439AA/OCSReskit.msi"
                    Check4SM;Add-WindowsFeature NET-Framework-Core
                    Write-Host "Installing..." -ForegroundColor Green -nonewline
                    cmd.exe /c $targetfolder\OCSReskit.msi /qb
                    Write-Host "Done!" -ForegroundColor Green
                }
                DocViewer                   
        }
        9 {
                if (!(get-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{88033F09-23A0-44EC-9063-7CBAA4BE4975}" -ErrorAction SilentlyContinue)){
                    GetIt "http://download.microsoft.com/download/3/3/8/338D2314-1D23-47C1-8BB4-80FD39B84EA6/RTCBPA.msi"
                    Check4SM;Add-WindowsFeature NET-Framework-Core
                    Write-Host "Installing..." -ForegroundColor Green -nonewline
                    cmd.exe /c $targetfolder\RTCBPA.msi /qb
                    Write-Host "Done!" -ForegroundColor Green
                }               
        }
        10 {
                if (!(get-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{94FD6E73-38F6-4DBE-AA3B-E403678868C9}" -ErrorAction SilentlyContinue)){
                Check4SM;Add-WindowsFeature NET-Framework-Core
                vcredist
               
                GetIt "http://download.microsoft.com/download/7/1/E/71EC25F9-575C-47BF-A4C0-E5DFFD42AA56/CapacityPlanningTool.msi"
                Write-Host "Installing..." -ForegroundColor Green -nonewline
                cmd.exe /c $targetfolder\CapacityPlanningTool.msi /qb
                Write-Host "Done!" -ForegroundColor green
                }
                DocViewer
            }
        11 { DisableIPv6 }
        12 { Check4SM;Add-WindowsFeature Telnet-Client }
        13 { VCRedist }
        14 {
                Check4SM;Add-WindowsFeature NET-Framework-Core
                GetIt "http://download.microsoft.com/download/3/B/1/3B13662A-8445-4238-A685-F15899032755/UcmaRuntimeSetup.exe"
                Write-Host "Installing..." -ForegroundColor Green -nonewline
                cmd.exe /c $targetfolder\UcmaRuntimeSetup.exe /q
                Write-Host "Done!" -ForegroundColor green
               
                GetIt "http://download.microsoft.com/download/9/E/2/9E2CBE89-A25F-4158-A2FC-CD227FC4ED14/IManExpert.msi"
                Write-Host "Installing..." -ForegroundColor Green -nonewline
                cmd.exe /c $targetfolder\IManExpert.msi /qb
                Write-Host "Done!" -ForegroundColor green
                }
        15 {cmd.exe /c "%windir%\system32\wuapp.exe startmenu"}
        98 { if (($WasInstalled -eq $false) -and (Get-Module BitsTransfer)){Write-Host "Removing BitsTransfer..." -NoNewLine;Remove-Module BitsTransfer;Write-Host "removed!" -ForegroundColor Green};Write-Host "Exiting and rebooting..."; Restart-Computer}
        99 { if (($WasInstalled -eq $false) -and (Get-Module BitsTransfer)){Write-Host "Removing BitsTransfer..." -NoNewLine;Remove-Module BitsTransfer;Write-Host "removed!" -ForegroundColor Green};popd;Write-Host "Exiting..."}
        default {write-host "You haven't selected any of the available options. "}
    }
} while ($opt -ne 99)

下载的脚本须要把后缀从TXT修改成PS1,你懂的。

相关文章
相关标签/搜索