zoukankan      html  css  js  c++  java
  • SharePoint 2013 pre-config

    #region 1. add winrm, application server and web server role
    Add-WindowsFeature winrm-iis-ext, Application-Server,Web-Server -IncludeAllSubFeature
    #endregion
    
    #region 2. disable UAC
    Function Test-RegistryValue 
    {
        param(
            [Alias("RegistryPath")]
            [Parameter(Position = 0)]
            [String]$Path
            ,
            [Alias("KeyName")]
            [Parameter(Position = 1)]
            [String]$Name
        )
    
        process 
        {
            if (Test-Path $Path) 
            {
                $Key = Get-Item -LiteralPath $Path
                if ($Key.GetValue($Name, $null) -ne $null)
                {
                    if ($PassThru)
                    {
                        Get-ItemProperty $Path $Name
                    }       
                    else
                    {
                        $true
                    }
                }
                else
                {
                    $false
                }
            }
            else
            {
                $false
            }
        }
    }
    
    Function Disable-UAC
    {
        $EnableUACRegistryPath = "REGISTRY::HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionPoliciesSystem"
        $EnableUACRegistryKeyName = "EnableLUA"
        $UACKeyExists = Test-RegistryValue -RegistryPath $EnableUACRegistryPath -KeyName $EnableUACRegistryKeyName 
        if ($UACKeyExists)
        {
            Set-ItemProperty -Path $EnableUACRegistryPath -Name $EnableUACRegistryKeyName -Value 0
        }
        else
        {
            New-ItemProperty -Path $EnableUACRegistryPath -Name $EnableUACRegistryKeyName -Value 0 -PropertyType "DWord"
        }
    }
    
    Disable-UAC
    #endregion
    
    #region 3. Run enable psremoting
    #Run winrm quickconfig defaults
    echo Y | winrm quickconfig
    
    #Run enable psremoting command with defaults
    enable-psremoting -force
    
    #Enabled Trusted Hosts for Universial Access
    cd wsman:
    cd localhostclient
    Set-Item TrustedHosts * -force
    restart-Service winrm
    echo "Complete"
    
    set-ExecutionPolicy RemoteSigned -Force
    
    #endregion
    
    Restart-Computer -Force -Confirm:$false
  • 相关阅读:
    基于 Web 的 Go 语言 IDE
    基于 Web 的 Go 语言 IDE
    语音芯片选型
    干簧管
    51单片机或PLC驱动3.5寸至52寸的数字TFTLCD屏、VGA接口显示器、电视机
    为什么做网线水晶头必须按照颜色顺序?
    51地图接口
    labview多个并行循环同时退出
    TCP和UDP的区别
    IMAQ Flatten Image to String VI的参数设置对比
  • 原文地址:https://www.cnblogs.com/fengwenit/p/3596677.html
Copyright © 2011-2022 走看看