zoukankan      html  css  js  c++  java
  • 【转】Powershell与jenkins集成部署的运用(powershell运用)

    powershell简介:

    远程管理采用的一种新的通信协议,Web Services for Management,简称WS-MAN它通过http或者https进行工作,WS-WAN的实现主要基于一个后台服务:Windows远程管理(WinRM)。Server2008R2中默认开启该服务,从Server2012开始,该服务便集成在系统中默认开启,Win7默认安装此服务,但是默认为禁用状态,Win8,Win10默认开启。这种远程连接不会被客户端察觉到,也不会占用远程连接数!

    powershell的简单运用:

    启动方式:
    powershell系统默认安装了,通过开始-运行-输入powershell,会弹出powershell的工作窗口,如图


    设置服务器白名单:
    命令: winrm set winrm/config/client ‘@{TrustedHosts=”*”}’


    开启远程服务:
    命令:winrm quickconfig
    注意:powershell需要以管理员身份运行,否则会报错误码 -2144108526 0x80338012,如图。

     

    更改为管理员身份运行,开启远程服务,如图。


    连接远程服务:
    命令:Enter-PSSession -ComputerName 【RemoteComputerName】 -Credential Ge【t-Credential】


    输入连接服务器的密码,连接成功后会显示服务器的名字或者IP地址,如图


    拷贝文件:
    命令:Copy-Item -Path [文件地址] -Destination [目标文件地址] -ToSession $mySession -Recurse -Force

    原文:https://blog.csdn.net/yunhua88/article/details/79034225

    碰到的问题: 执行Enter-PSSession -ComputerName 【RemoteComputerName】 -Credential Ge【t-Credential】 时碰到以下问题。

    解决办法:

    设置防火墙

    powershell 中运行

    netsh advfirewall firewall set rule group="Windows 远程管理" new enable=yes

  • 相关阅读:
    「luogu2414」[NOI2011]阿狸的打字机
    【模板】KMP算法,AC自动机
    「luogu2336」[SCOI2012]喵星球上的点名
    「luogu2463」[SDOI2008]Sandy的卡片
    【模板】后缀数组
    「luogu1972」 [SDOI2009]HH的项链
    北师大部分题解
    D:Sequence Swapping
    Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 2)
    点双连通分量F. Simple Cycles Edges
  • 原文地址:https://www.cnblogs.com/keepSmile/p/10635560.html
Copyright © 2011-2022 走看看