上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 49 下一页
摘要: 1. 多条件筛选 PS /root> $person_li 白雪公主今年10岁了 小猪今年10岁了 灰太狼今年20岁了 哪吒今年5岁了 # 找到包含5和20的条目 PS /root> $person_li | where {($_ | Select-String 5) -or ($_ | Selec 阅读全文
posted @ 2021-08-19 13:02 LeoShi2020 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 1. PowerShell的函数 function <函数名称>(<参数1>,<参数2>...) {<函数体>} 2. 传参 function person_info ($name="小猪",$age="10") { Write-Output $name"今年"$age"岁了" } PS /root 阅读全文
posted @ 2021-08-19 12:33 LeoShi2020 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1. '#' 截取关键字右侧 ]# STR='DISTANCE_ESXi_7SERVER_IP=172.15.7.133' ]# echo ${STR} DISTANCE_ESXi_SERVER_IP=172.15.7.133 # 从左往右找到第一个关键字7匹配,截取关键字右侧所有字符 ]# ech 阅读全文
posted @ 2021-08-18 11:34 LeoShi2020 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 1. 下载安装包 pip download -d <包路径> <包名称> pip download -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com -d paramiko paramiko 2. 安装依赖包 pip i 阅读全文
posted @ 2021-08-16 11:09 LeoShi2020 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 1. 循环遍历 foreach $a='a','b','c' foreach ($i in $a) { echo $i } a b c 2. 循环遍历 foreach-object $a | ForEach-Object{ echo $_ } a b c 3. for循环 for ($counter 阅读全文
posted @ 2021-08-13 14:04 LeoShi2020 阅读(1036) 评论(0) 推荐(0) 编辑
摘要: 1. 查看虚拟机列表 PS /root> Get-VM Name PowerState Num CPUs MemoryGB mysql数据库测试 PoweredOn 8 32.000 中间件测试服务器 PoweredOn 8 16.000 test01 PoweredOn 2 4.000 VMwar 阅读全文
posted @ 2021-08-13 12:58 LeoShi2020 阅读(1019) 评论(0) 推荐(0) 编辑
摘要: 1. 连接ESXi服务器 Connect-VIServer -Server <IPAddress> -Protocol <https> -User <root> -Password <pass> PS /root> Connect-VIServer -Server 10.1.1.1 Specify 阅读全文
posted @ 2021-08-13 10:53 LeoShi2020 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1. 查看当前素有的版本 PS /root> Find-Module -Repository PSGallery -Name VMware.PowerCLI -AllVersions | ft -AutoSize Version Name Repository Description 12.3.0. 阅读全文
posted @ 2021-08-13 09:01 LeoShi2020 阅读(760) 评论(0) 推荐(0) 编辑
摘要: 1. 下载地址 curl -O https://packages.microsoft.com/rhel/7/prod/powershell-7.1.3-1.rhel.7.x86_64.rpm 2. 安装依赖 yum install -y libicu 3. 安装powercli rpm -ivh p 阅读全文
posted @ 2021-08-12 16:14 LeoShi2020 阅读(410) 评论(0) 推荐(1) 编辑
摘要: 1. 修改转发配置文件 echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf 2. 配置文件生效 sysctl -p 3. 配置防火墙 --add-forward-port=port=<portid>[-<portid>]:proto=<protocol> 阅读全文
posted @ 2021-08-10 23:56 LeoShi2020 阅读(423) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 49 下一页