通过Wmi问题启动远程Pc上的进程 [英] Start process on remote Pc via Wmi problem

查看:53
本文介绍了通过Wmi问题启动远程Pc上的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试开始批量找不到system32文件夹时出现问题


如果我在C:\ temp上复制oro.cmd并尝试启动oro。使用RemoteStart的mcd和call函数(remoteServer,{" c:\ temp \oro.cmd"}) 不起作用


我的问题是cmd必须在windows文件夹上吗?


这是我的代码:


   RemoteStart(remoteServer,{" oro.cmd"})



 功能RemoteStart(ByVal Server As String,ByVal sProcess As Object)

       尝试

            Dim connOptions As ConnectionOptions = New ConnectionOptions()

            connOptions.Username =" sms"

            connOptions.Password =" Mc"

            connOptions.EnablePrivileges = True

           暗淡theScope作为管理范围=新管理范围(" \\"&安培;服务器&安培;" \root\cimv2" ;, connOptions)

    &NBSP ;       Dim theClass As New ManagementClass(theScope,New ManagementPath("Win32_Process"),New ObjectGetOptions())

             theClass.InvokeMethod(" Create",sProcess)

        C ex ex As Exception

            Console.WriteLine(ex.Message)

       结束尝试



       什么都不退货


   最终功能



你能帮助我吗?

解决方案

你好termi_80,


你能告诉我oro.cmd是什么吗?你自己写了吗?可以成功放入system32文件夹吗?



最好的问候,


Cherry


I have a problem when i try to start batch not locate on system32 folder

If i copy oro.cmd on C:\temp and try to start oro.mcd and call function with RemoteStart(remoteServer, {"c:\temp\oro.cmd"})  doesn't works

My question is cmd must be on windows folder??

this is my code:

   RemoteStart(remoteServer, {"oro.cmd"})

 Function RemoteStart(ByVal Server As String, ByVal sProcess As Object)
        Try
            Dim connOptions As ConnectionOptions = New ConnectionOptions()
            connOptions.Username = "sms"
            connOptions.Password = "Mc"
            connOptions.EnablePrivileges = True
            Dim theScope As ManagementScope = New ManagementScope("\\" & Server & "\root\cimv2", connOptions)
            Dim theClass As New ManagementClass(theScope, New ManagementPath("Win32_Process"), New ObjectGetOptions())
            theClass.InvokeMethod("Create", sProcess)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

        Return Nothing

    End Function

Could you help me?

解决方案

Hi termi_80,

Can you tell me what the oro.cmd is? Did you write it yourself? Can successfully put in system32 folder?

Best Regards,

Cherry


这篇关于通过Wmi问题启动远程Pc上的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆