Powershell 脚本替换 sc 配置
Powershell script replace sc config
美好的一天,
我寻找与
相同的命令
sc config BITS type= own
在 Powershell 中。
我认为是
set-service -name BITS -computername server1234 -idon´t know
我的问题是我的 INVOKE-COMMAND 不起作用。
但是所有的脚本都只能在这一行中工作,而行不通。
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {Start-Process cmd -ArgumentList "/c 'sc config bits type= own'"}
如果有人能帮助我,那就太好了。
谢谢
问候语
一月
在我的脚本中使用
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {Start-Process cmd -ArgumentList "/c sc config bits type= own"}
但是我搜索了一个没有cmd的Powershell版本
运行可以直接吗?
Invoke-Command $serverneedhelp { sc config bits type= own }
另一种选择是使用 wmi:Configure service with Set-Service
我知道这是旧线程,但也许有人会从中受益。
对我有用的是:
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {& SC.exe config "bits" type= own}
美好的一天,
我寻找与
相同的命令sc config BITS type= own
在 Powershell 中。
我认为是
set-service -name BITS -computername server1234 -idon´t know
我的问题是我的 INVOKE-COMMAND 不起作用。 但是所有的脚本都只能在这一行中工作,而行不通。
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {Start-Process cmd -ArgumentList "/c 'sc config bits type= own'"}
如果有人能帮助我,那就太好了。 谢谢
问候语 一月
在我的脚本中使用
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {Start-Process cmd -ArgumentList "/c sc config bits type= own"}
但是我搜索了一个没有cmd的Powershell版本
运行可以直接吗?
Invoke-Command $serverneedhelp { sc config bits type= own }
另一种选择是使用 wmi:Configure service with Set-Service
我知道这是旧线程,但也许有人会从中受益。 对我有用的是:
Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {& SC.exe config "bits" type= own}