1 Star 0 Fork 54

feiman/kasini3000

forked from chuanjiao10/kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
bkj_install_k记饭店_win被控机.ps1 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
#建议保存编码为:bom头 + utf8
# 启用winrm,安装插件。非必要安装ps6,或ps7。
#Requires -RunAsAdministrator
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error '信息:此脚本只能在被控机上运行。'
}
else
{
Write-Error 'note:Information: This script can only be run on NODE'
}
if (($PSVersionTable.PSVersion.Major -lt 5) -and ($PSVersionTable.PSVersion.Minor -lt 1))
{
Write-Error '错误:powershell版本太低。必须是powershell5.1'
Exit 11
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
$win7 = powershell.exe -command { (Get-WmiObject -Class Win32_OperatingSystem).Caption -like "*7*" }
$win2008 = powershell.exe -command { (Get-WmiObject -Class Win32_OperatingSystem).Caption -like "*2008*" }
if ( $win7 -or $win2008 )
{
Write-Warning '卡死你3000被控机,支持win7,支持win2008。'
}
#把网卡设置成专用
Get-NetConnectionProfile -InterfaceAlias '以太网' | Set-NetConnectionProfile -NetworkCategory Private
Get-NetConnectionProfile -InterfaceAlias 'WLAN' | Set-NetConnectionProfile -NetworkCategory Private
#win被控机,启用winrm。
Enable-PSRemoting -SkipNetworkProfileCheck -Force
Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-NoScope" -RemoteAddress Any
Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP" -RemoteAddress Any
sc.exe config "winrm" start= auto #为了兼容win7,win2008
Restart-Service WinRM #并重启服务
}
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PowerShell
1
https://gitee.com/feiman8888/kasini3000.git
[email protected]:feiman8888/kasini3000.git
feiman8888
kasini3000
kasini3000
master

搜索帮助