システムに実行可能ファイルが残っていない場合、Windows サービスをアンインストールするにはどうすればよいですか? installutil -u
システムに実行可能ファイルが残っていないため、実行できません。サービス コンソールにサービスのエントリがまだ表示されます。
この状態の理由は、サービスを正しく削除しない msi パッケージの問題が原因である可能性がありますが、サービスがこの状態になったらどうすれば修正できますか?
システムに実行可能ファイルが残っていない場合、Windows サービスをアンインストールするにはどうすればよいですか? installutil -u
システムに実行可能ファイルが残っていないため、実行できません。サービス コンソールにサービスのエントリがまだ表示されます。
この状態の理由は、サービスを正しく削除しない msi パッケージの問題が原因である可能性がありますが、サービスがこの状態になったらどうすれば修正できますか?
「administrator」コマンドプロンプトで次のコマンドを実行すると、sc.exe(Windowsリソースキットに含まれていると思います)を使用してアンインストールできるはずです。
sc.exe delete <service name>
ここ<service name>
で、は、exeではなく、サービス管理コンソールに表示されるサービス自体の名前です。
sc.exeはSystemフォルダーにあり、実行するには管理者権限が必要です。詳細については、このMicrosoftKBの記事を参照してください。
または、 DeleteService() APIを直接呼び出すこともできます。OpenSCManager()などを介してサービスコントロールマネージャーへのハンドルを取得する必要があるため、この方法はもう少し複雑ですが、一方で、何が起こっているかをより細かく制御できます。
サービスを削除するためのpowershellスクリプトは次のとおりですfoo
$foo= Get-WmiObject -Class Win32_Service -Filter "Name='foo'"
$foo.delete()
Windows XPで試してみたところ、うまくいきました
ローカル コンピューター: sc \\. [サービス名] を削除
Deleting services in Windows Server 2003
We can use sc.exe in the Windows Server 2003 to control services, create services and delete services. Since some people thought they must directly modify the registry to delete a service, I would like to share how to use sc.exe to delete a service without directly modifying the registry so that decreased the possibility for system failures.
To delete a service:
Click “start“ - “run“, and then enter “cmd“ to open Microsoft Command Console.
Enter command:
sc servername delete servicename
For instance, sc \\dc delete myservice
(Note: In this example, dc is my Domain Controller Server name, which is not the local machine, myservice is the name of the service I want to delete on the DC server.)
Below is the official help of all sc functions:
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc
これを行う私のお気に入りの方法は、SysinternalsAutorunsアプリケーションを使用することです。サービスを選択して削除を押すだけです。
同じサービスの実行可能ファイルのコピーを作成し、既存のサービスの同じパスに貼り付けてからアンインストールします。