主页 > 知识库 > Rcmd.vbs [Remote Cmd with wmi]远程脚本

Rcmd.vbs [Remote Cmd with wmi]远程脚本

热门标签:百度地图标注怎么卸载 前锋办理400电话申请 外呼营销下单系统 加盟电销机器人好的品牌 办理胶州400电话财税 陕西高频外呼回拨系统哪家好 海外美发店地图标注 新密防封卡外呼系统违法吗 打电话的外呼系统贵不贵
复制代码 代码如下:

On Error Resume Next
Set outstreem=Wscript.stdout
If (LCase(Right(Wscript.fullname,11))="Wscript.exe") Then
Set objShell=Wscript.CreateObject("Wscript.shell")
objShell.Run("cmd.exe /k cscript //nologo "Chr(34)Wscript.ScriptFullNameChr(34))
Wscript.Quit
End If
If Wscript.arguments.Count4 Then
usage()
Wscript.echo "Not enough Parameters."
Wscript.Quit
End If

ip=Wscript.arguments(0)
username=Wscript.arguments(1)
password=Wscript.arguments(2)
CmdStr=Wscript.arguments(3)
EchoStr=Wscript.arguments(4)
foldername="c:\\windows\\temp\\"

wsh.echo "Conneting "ip" ...."
Set objlocator=CreateObject("wbemscripting.swbemlocator")
Set objswbemservices=objlocator.connectserver(ip,"root/cimv2",username,password)
showerror(err.number)
Set Win_Process=objswbemservices.Get("Win32_ProcessStartup")
Set Hide_Windows=Win_Process.SpawnInstance_
Hide_Windows.ShowWindow=12
Set Rcmd=objswbemservices.Get("Win32_Process")
Set colFiles = objswbemservices.ExecQuery _
("Select * from CIM_Datafile Where Name = '"foldername"read.vbs'")
If colFiles.Count = 0 Then
wsh.echo "Not found read.vbs! Create Now!"
Create_read()
End If


If EchoStr = "0" Then
msg=Rcmd.create("cmd /c "CmdStr,Null,Hide_Windows,intProcessID)
Else
msg=Rcmd.create("cmd /c cscript %windir%\temp\read.vbs """CmdStr"""",Null,Hide_Windows,intProcessID)
End If

If msg = 0 Then
wsh.echo "Command success..."
Else
showerror(Err.Number)
End If

wsh.echo "Please Wait 3 Second ...."
wsh.sleep(3000)
Set StdOut = Wscript.StdOut
Set oReg=objlocator.connectserver(ip,"root/default",username,password).Get("stdregprov")
oReg.GetMultiStringValue H80000002,"SOFTWARE\Clients","cmd" ,arrValues
wsh.echo String(79,"*")
wsh.echo cmdstrChr(13)Chr(10)
'wsh.echo arrvalues
For Each strValue In arrValues
StdOut.WriteLine strValue
Next
oReg.DeleteValue H80000002,"SOFTWARE\Clients","cmd"

Sub Create_read()
RunYN =Rcmd.create("cmd /c echo set ws=WScript.CreateObject(^""WScript.Shell^"")> %windir%\temp\read.vbs"_
"echo str=ws.Exec(^""cmd /c ^""^wscript.arguments(0)).StdOut.ReadAll:set ws=nothing>> %windir%\temp\read.vbs"_
"echo Set oReg=GetObject(^""winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv^"")>> %windir%\temp\read.vbs"_
"echo oReg.SetMultiStringValue ^H80000002,^""SOFTWARE\Clients^"",^""cmd^"",Array(str) >> %windir%\temp\read.vbs",Null,Hide_Windows,intProcessID)
If RunYN = 0 Then
wsh.echo "read.vbs Created!!!"
Else
showerror(Err.Number)
End If

End Sub

Function showerroronly(errornumber)
If errornumber Then
wsh.echo "Error 0x"CStr(Hex(Err.Number))" ."
If Err.Description > "" Then
wsh.echo "Error Description: "Err.Description"."
End If
Wscript.Quit
Else
outstreem.Write "."
End If
End Function


Sub usage()
wsh.echo string(79,"*")
wsh.echo "Rcmd v1.01 by NetPatch"
wsh.echo "Usage:"
wsh.echo "cscript "wscript.scriptfullname" targetIP username password Command"
wsh.echo "cscript "wscript.scriptfullname" targetIP username password Command 0 //No echo"
wsh.echo string(79,"*")vbcrlf
end Sub
您可能感兴趣的文章:
  • VB中使用WMI获取系统硬件和软件有关信息
  • VBS调用WMI遍历搜索硬盘文件并计数的方法
  • vbs通过WMI修改文件文件夹的NTFS权限
  • WMI StdRegProv 通过wmi操作注册表的vbscript实现代码 (本地或远程)
  • VBS通过WMI监视注册表变动的代码
  • VBS通过WMI获取CPU使用率的代码
  • 将WMI中的DateTime类型转换成VBS时间的函数代码
  • VBS调用WMI实现搜索硬盘mp3文件
  • VBS调用WMI快速关闭IE的脚本
  • VBS脚本使用WMI操作注册表的代码
  • vbs wmi获取电脑硬件信息实例
  • 初窥WMI_Vbs脚本编程简明教程补充读物
  • 使用WMI得到计算机的信息

标签:梅州 伊春 河南 咸阳 阜阳 牡丹江 四平 武威

巨人网络通讯声明:本文标题《Rcmd.vbs [Remote Cmd with wmi]远程脚本》,本文关键词  Rcmd.vbs,Remote,Cmd,with,wmi,远程,;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 下面列出与本文章《Rcmd.vbs [Remote Cmd with wmi]远程脚本》相关的同类信息!
  • 本页收集关于Rcmd.vbs [Remote Cmd with wmi]远程脚本的相关信息资讯供网民参考!
  • 推荐文章