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
Boot

Device driver started by the operating system loader. This value is valid only for driver services.

System

Device driver started by the operating system initialization process. This value is valid only for driver services.

Automatic

Service to be started automatically by the Service Control Manager during system startup.

Manual

Service to be started by the Service Control Manager when a process calls theStartService method.

Disabled

Service that can no longer be started.

Return value

Return code Description
0

Success

1

Not Supported

2

Access Denied

3

Dependent Services Running

4

Invalid Service Control

5

Service Cannot Accept Control

6

Service Not Active

7

Service Request Timeout

8

Unknown Failure

9

Path Not Found

10

Service Already Running

11

Service Database Locked

12

Service Dependency Deleted

13

Service Dependency Failure

14

Service Disabled

15

Service Logon Failure

16

Service Marked For Deletion

17

Service No Thread

18

Status Circular Dependency

19

Status Duplicate Name

20

Status Invalid Name

21

Status Invalid Parameter

22

Status Invalid Service Account

23

Status Service Exists

24

Service Already Paused

远程计算机 进程/服务 启动停止(WMI)的更多相关文章

  1. python 远程调度进程服务与客户端

    python 远程调度进程服务与客户端 核心思想: 在本地或远程机器上创建一个进程,提供调度服务.使用了 APScheduler. 安装:APScheduler $ wget https://pypi ...

  2. Linux Oracle服务启动&停止脚本与开机自启动

    在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...

  3. Linux Oracle服务启动&停止脚本与开机自启动[转]

    在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...

  4. 【转】Linux Oracle服务启动&停止脚本与开机自启动

    在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设置相关参数,首先先介 ...

  5. (转)Linux Oracle服务启动&停止脚本与开机自启动

    在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...

  6. 在linux上oracle服务启动停止详细

    转至:https://www.cnblogs.com/baihuitestsoftware/articles/6365431.html 在CentOS 6.3下安装完Oracle 10g R2,重开机 ...

  7. Windows下使用service.bat安装tomcat服务, 启动停止tomcat服务

    在项目开发过程中,以前只是在Eclipse中配置.启动.停止tomcat服务器 如果只想在机器中使用tomcat服务器,而不想安装MyEclipse,可以使用service.bat 将tomcat安装 ...

  8. 【Linux】常用指令、ps查看进程、kill杀进程、启动停止tomcat命令、查看日志、查看端口、find查找文件

    1.说出 10 个 linux 常用的指令 1) ls 查看目录中的文件 2)cd /home 进入 '/ home' 目录:cd .. 返回上一级目录:cd ../.. 返回上两级目录 3)mkdi ...

  9. 使用shell脚本批处理控制大数据环境服务启动停止

    三台集群机器: master   192.168.168.200 slave1     192.168.168.201 slave2     192.168.168.202 1.start-maste ...

随机推荐

  1. Ubuntu系统下OpenDaylight源码编译安装

    操作系统:Linux x64 / Ubuntu 14.04 研究领域:软件定义网络SDN (Software-defined Networking) 开发组件:OpenDaylight 声明:转载请注 ...

  2. Week4——结对练习&团队作业1

    Deadline: 2017-10-14 10:00PM,以博客发表日期为准. 评分基准: 按时交 - 有分(结对代码-10分,结对博客-10分,团队博客-10分),检查的项目包括后文的三个方面 按要 ...

  3. Python urllib简单使用

    Python的urllib和urllib2模块都做与请求URL相关的操作. 它们最显著的差异为: urllib2可以接受一个Request对象,并以此可以来设置一个URL的headers,但是urll ...

  4. tcpdump一个命令的剖析

    简单介绍:用简单的话来定义tcpdump,就是:dump the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具. tcpdump可以将网络中传送的数据 ...

  5. [转]Asp.Net 网站多语言解决方案

    本文转自:https://www.cnblogs.com/FredTang/archive/2013/01/23/2873231.html 最近领导要求实现PMSWeb应用程序的多区域语言的支持,所以 ...

  6. 啰里吧嗦jvm

    一.为什么要了解jvm 有次做项目的时候,程序run起来的时候,总是报OutOfMemoryError,有老司机教我们用jconsole.exe看内存溢出问题 就是这货启动jconsole后,发现一个 ...

  7. spring boot 学习入门篇【spring boot项目的搭建以及如何加载jsp界面】

    [ 前言]  Spring Boot 简介:Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置, ...

  8. MyBatis中的条件查询(动态sql)

    本文将介绍使用MyBatis框架,编写DAO层接口类和接口类对应的sql映射文件,使用动态sql查询满足条件的用户集合. 首先,需要创建一个实体类User,供封装数据使用: package com.x ...

  9. wamp 安装monggo扩展

    1.下载对应的monggo扩展 http://pecl.php.net/package/mongo 2. 找对应的版本 放在D:\program\wamp\bin\php\php5.5.12\ext ...

  10. charles 抓包 https 证书

    1. 概述 环境:这里是windows8 和 android (参考了ios环境的博客) 手机app点击发出http及https的请求,之前抓包都有请求的相关内容展示,这次没有,原来之前的一直抓的是h ...