• windows 2008 r2 x64 离线升级PowerShell3.0 及打开WinRM模块并安装openssh


    1. bat脚本
    echo off
    set apath=%~dp0
    :: 如果运行提示找不到文件apath 写完整路径
    echo "install net4.0"
    %apath%\dotNetFx45_Full_x86_x64.exe  /quiet /norestart
    start /w pkgmgr /iu:PowerShell
    echo y|powershell set-executionpolicy remotesigned
    echo "PowerShell 3.0"
    %apath%\Windows6.1-KB2506143-x64.msu  -ArgumentList /quiet 
    REG add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"  /v "ansible" /t REG_SZ /d "\"%apath%Powerl.bat\"" /f
    echo PowerShell %apath%\ConfigureRemotingForAnsible.ps1>%apath%Powerl.bat
    echo REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "ansible" /f >>%apath%Powerl.bat 
    pause

    离线升级包下载地址:

    链接:http://pan.baidu.com/s/1dE2h9aL 密码:jd7j

    安装完成需要重启服务器。

     2. 查看powershell版本

    PS C:\> $PSVersionTable

     3 然后即可安装openssh

    1. 下载最新的 OpenSSH (github.com),并解压到C:\Program Files\OpenSSH
    2. 安装openssh
    cd "C:\Program Files\OpenSSH"
    powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
    1. 设置 Firewalld
    New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
    # 如果 win7/win2008 执行上面的命令报错请执行此处的命令 netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
     
    1. 启动 OpenSSH
    net start sshd Set-Service sshd -StartupType Automatic


  • 相关阅读:
    微信小程序右上角胶囊的位置
    NLP复习大纲
    网站收藏
    css中如何调整插入背景图片的大小
    禁止Power Apps Canvas用户通过SharePoint Online UI界面访问站点list
    c++ vector基本知识
    c++ map基本知识
    c++ string操作
    python学习笔记30:操作excel
    c++, 如何run一个c++程序
  • 原文地址:https://www.cnblogs.com/ityunwei/p/16419646.html
Copyright © 2020-2023  润新知