簡體   English   中英

Powershell 腳本替換 sc 配置

[英]Powershell script replace sc config

再會,

我尋找與相同的命令

sc config BITS type= own 我認為 ist with 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: 使用 Set-Service 配置服務

我知道這是舊線程,但也許有人會從中受益。 對我有用的是:

Invoke-Command -ComputerName $serverneedhelp -ScriptBlock {& SC.exe config "bits" type= own}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM