远程计算机 进程/服务 启动停止(WMI)
WMI的远程管理需要其计算机的本地管理员组权限,例:gwmi win32_computersystem -computer win08r2d
#在远程计算机上启动 notepad.exe 进程
invoke-wmimethod -path win32_process -name create -argumentlist notepad.exe -computername "win08r2d"
#停止 notepad.exe 进程
$np = get-wmiobject -query "select * from win32_process where name='notepad.exe'" -computername "win08r2d"
$np | remove-wmiobject
Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList "GPUPDATE /FORCE" -EnableAllPrivileges -ComputerName $RemoteComputer
==========================================
获取远程计算机上的服务
$server = gwmi win32_service -ComputerName win08r2d|?{$_.name -eq "dhcp"}
#查看服务当前运行状态
$server.state
#更改服务启动类型:
$server.ChangeStartMode("Automatic") ,不可以为“Auto”
$server.ChangeStartMode("Manual")
$server.ChangeStartMode("Disabled")
返回值中 ReturnValue : 0 表示成功
#启动/停止服务
$server.StopService()
$server.StartService()
服务启动类型如下:
| Value | Meaning |
|---|---|
|
Device driver started by the operating system loader. This value is valid only for driver services. |
|
Device driver started by the operating system initialization process. This value is valid only for driver services. |
|
Service to be started automatically by the Service Control Manager during system startup. |
|
Service to be started by the Service Control Manager when a process calls theStartService method. |
|
Service that can no longer be started. |
Return value
| Return code | Description |
|---|---|
|
Success |
|
Not Supported |
|
Access Denied |
|
Dependent Services Running |
|
Invalid Service Control |
|
Service Cannot Accept Control |
|
Service Not Active |
|
Service Request Timeout |
|
Unknown Failure |
|
Path Not Found |
|
Service Already Running |
|
Service Database Locked |
|
Service Dependency Deleted |
|
Service Dependency Failure |
|
Service Disabled |
|
Service Logon Failure |
|
Service Marked For Deletion |
|
Service No Thread |
|
Status Circular Dependency |
|
Status Duplicate Name |
|
Status Invalid Name |
|
Status Invalid Parameter |
|
Status Invalid Service Account |
|
Status Service Exists |
|
Service Already Paused |
远程计算机 进程/服务 启动停止(WMI)的更多相关文章
- python 远程调度进程服务与客户端
python 远程调度进程服务与客户端 核心思想: 在本地或远程机器上创建一个进程,提供调度服务.使用了 APScheduler. 安装:APScheduler $ wget https://pypi ...
- Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- Linux Oracle服务启动&停止脚本与开机自启动[转]
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- 【转】Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设置相关参数,首先先介 ...
- (转)Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- 在linux上oracle服务启动停止详细
转至:https://www.cnblogs.com/baihuitestsoftware/articles/6365431.html 在CentOS 6.3下安装完Oracle 10g R2,重开机 ...
- Windows下使用service.bat安装tomcat服务, 启动停止tomcat服务
在项目开发过程中,以前只是在Eclipse中配置.启动.停止tomcat服务器 如果只想在机器中使用tomcat服务器,而不想安装MyEclipse,可以使用service.bat 将tomcat安装 ...
- 【Linux】常用指令、ps查看进程、kill杀进程、启动停止tomcat命令、查看日志、查看端口、find查找文件
1.说出 10 个 linux 常用的指令 1) ls 查看目录中的文件 2)cd /home 进入 '/ home' 目录:cd .. 返回上一级目录:cd ../.. 返回上两级目录 3)mkdi ...
- 使用shell脚本批处理控制大数据环境服务启动停止
三台集群机器: master 192.168.168.200 slave1 192.168.168.201 slave2 192.168.168.202 1.start-maste ...
随机推荐
- springboot-14-自定义properties文件值注入javaBean中
被这个问题困扰了好几天.... 在spring中, 从资源文件向bean中注入值非常简单, 只需要properties文件被spring加载, 然后在被spring管理的类写响应的属性, 然后 @Va ...
- springboot-7-配置druid数据源监视
关于druid数据源的配置, 上个博客已经说过了,再说一遍吧 , 引入依赖 , 配置properties参数 , 编写servlet和filter提供页面监视 , 测试 1, 引入maven依赖 &l ...
- sql server 运算
--Sql Server 乘法运算--select (d.RepaymentSchedule*d.MonthlyPayment) as ExpectedReceivablePayment from T ...
- BG.Hadoop.Master
1. 安装JDK JDK安装包复制到/opt文件夹 cd /opt rpm -ivh jdk-8u121-linux-x64.rpm vim /etc/profile 增加 JAVA_HOME=/us ...
- 转载:sql用逗号连接多张表对应哪个join?
http://blog.csdn.net/huanghanqian/article/details/52847835 四种join的区别已老生常谈: INNER JOIN(也可简写为JOIN): 如果 ...
- 我用ASP.NET缓存之数据缓存
[我的理解] Cache,是内置的对象集合.是全局的,类似于static Arraylist.它是线程安全的,添加或修改Cache中的项目时,不需要锁定或者解除Cache. 添加 Cache[Key] ...
- centos文件基本操作
centos彻底删除文件夹.文件命令(centos 新建.删除.移动.复制等命令: 1.新建文件夹 mkdir 文件名 新建一个名为test的文件夹在home下 view source1 mkdir ...
- 关于nginx下drupal7无法$_GET获取参数的问题
参考:nginx 官方drupal 配置 - Drupal | NGINX 之前配置好了LNMP下的drupal7(7.59版本),简洁路径也配好了.但是在使用过程出现问题. 配置的nginx.con ...
- JavaScript小细节点罗列(1)
共勉! 属性访问表达式 众所周知,JavaScript为属性的访问定义了两种语法方式: 表达式.标识符 // 表达式(指定对象) 标识符(指定需要访问的属性的名称) 表达式[表达式] //表达式1(指 ...
- CSS之浮动布局(float,浮动原理,清除/闭合浮动方法)
css之浮动布局 本人博客:查看文章 1.什么是浮动:在我们布局的时用到的一种技术,能够方便我们进行布局,通过让元素浮动,我们可以使元素在水平上左右移动,再通过margin属性调整位置 2.浮动的 ...