返回首页
EN
H7 / SECURITY RESEARCH NOTES

使用powershell创建windows服务

环境说明

IPHOSTNAMENOTE
10.10.10.88win10_dqy实验主机

powershell脚本内容如下:

  • 以管理员权限打开 powershell 创建Windows服务
$service_name = "test_exploit";
$exe_path = "C:\Windows\System32\calc.exe";
New-Service -Name $service_name -BinaryPathName $exe_path -StartupType Automatic | Out-String;
  • 如下图:

清理命令

  • 如果windows服务正在运行,则首先需要先停止
Stop-Service -Name "test_exploit"; 
  • 停止服务后,进行删除
sc.exe delete "test_exploit";