Tag:WMI

  • VBS calls WMI to search hard disk files and count

    Time:2021-12-12

    A VBS written many years ago called WMI to traverse the function of searching hard disk files and counting. Today, I sorted the network disk, saw it and sent it Core code: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 […]

  • SQL Server 2012 cannot connect to the WMI provider solution

    Time:2021-10-27

    Today, a colleague encountered the following error when starting the SQL Server 2012 configuration manager of his working machine: Unable to connect to WMI provider. You do not have permission or the server cannot be accessed. Note that you can only use SQL Server Configuration Manager to manage SQL Server 2005 servers. The specified module […]

  • Explain the solution of the unavailable WMI RPC server

    Time:2021-5-6

    This paper introduces the solution of the unavailable WMI RPC server, and shares it with you. The details are as follows: ConnectionOptions connectionOptions = new ConnectionOptions(); connectionOptions.Username = userName; connectionOptions.Password = password; ManagementScope managementScope = new ManagementScope(“\\\\” + host + “\\root\\cimv2”, connectionOptions); try { managementScope.Connect(); } catch { } Solution in case of “RPC server […]

  • On WMI_ VBS scripting tutorial Supplement 1 / 2

    Time:2020-9-12

    Today, I would like to introduce a friend to you. It is Microsoft Windows Management Instrumentation (WMI). The Chinese name is windows management specification. Since Windows 2000, WMI (Windows Management specification) has been built into the operating system, and has become an important part of windows system management. So it’s easy to see it, because […]

  • An example of acquiring computer hardware information by VBS WMI

    Time:2020-7-21

    Set wmi=GetObject(“winmgmts:\\”) Set board=wmi.instancesof(“win32_baseboard”) For Each b In board msg=”main board:”&b.Manufacturer&vbTab&b.product&vbTab&Chr(13) Next msg=msg&Chr(13)&”—“+Chr(13) Set cpus=wmi.instancesof(“win32_processor”) MSG = MSG & “CPU characteristics:” Chr (13)For Each cpu In cpus msg=msg+cpu.deviceid&vbTab&cpu.name&Chr(13) _ &vbtab&cpu.SocketDesignation&vbtab&cpu.CurrentClockSpeed&”MHz”&vbtab&cpu.l2cachesize&”Kb_L2″&Chr(13) Next msg=msg&Chr(13)&”—“+Chr(13) Set mem=wmi.instancesof(“win32_physicalmemory”) MSG = MSG & “memory capacity:” Chr (13)For Each    m In mem msg=msg&m.tag&space(10)&m.capacity&+Chr(13) Next Set mem=wmi.instancesof(“win32_computersystem”) For Each m In mem MSG = MSG & “total memory:” round ((m.totalphysicalmemory / 1024 ^ 2), 2) & “m” + Chr (13)Next msg=msg&Chr(13)&”—“+Chr(13) Set display=wmi.instancesof(“Win32_videocontroller”) MSG = […]

  • Vbs script code to operate registry using WMI page 1 / 2

    Time:2020-7-7

    oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath    oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue    oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue    oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strPath,strValueName,uBinary    oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues    oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath    oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName    oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue    oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue    oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,uBinary    oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues    ‘——————————————————————————————-    Const HKEY_CLASSES_ROOT = &H80000000    Const HKEY_CURRENT_USER = &H80000001    Const HKEY_LOCAL_MACHINE = &H80000002    Const HKEY_USERS = &H80000003    Const HKEY_CURRENT_CONFIG = &H80000005    ‘create a registry keyconst HKEY_LOCAL_MACHINE = &H80000002    strComputer = “.”   Set StdOut = WScript.StdOut    Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_     strComputer & “\root\default:StdRegProv”)    strKeyPath = “SOFTWARE\System Admin Scripting Guide”   oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath    ‘create a multi string valueconst HKEY_LOCAL_MACHINE = &H80000002    strComputer = “.”   Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_     strComputer & “\root\default:StdRegProv”)    strKeyPath = “SOFTWARE\System Admin Scripting Guide”   strValueName = “Multi String Value Name”   arrStringValues = Array(“first string”, “second string”,_     “third string”, “fourth string”)    oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_    strValueName,arrStringValues       ‘create an extended string valueconst HKEY_LOCAL_MACHINE = &H80000002    strComputer = “.”   Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_     strComputer & “\root\default:StdRegProv”)    strKeyPath = “SOFTWARE\System Admin Scripting Guide”   strValueName = “Expanded String Value Name”   strValue = “%PATHEXT%”   […]

  • VBS calls WMI to quickly close ie script

    Time:2020-6-29

    VBS calls WMI to kill IESave the following file as KillIE.vbs When you want to close all web pages opened with ie, double-click to execute, Set wmi=GetObject(“winmgmts:\\.”) Set pro_s=wmi.instancesof(“win32_process”) For Each p In pro_s  if p.name=”iexplore.exe” then p.terminate() Next This is to extract because: I usually open a lot of web pages, close also to close half a day, with this is really good. […]

  • Use WMI change ie proxy

    Time:2020-5-8

    Save the following code as vbs Copy codeThe code is as follows: If WScript.Arguments.Count = 0 Then GetI = -1 Else GetI = CInt(WScript.Arguments(0)) End If Call YourCode() ‘write all the agents you get in a text file (IP. Txt), one line at a time: IP: PortIPS = CreateObject(“Scripting.FileSystemObject”).OpenTextFile(“IP.txt”, 1, True).ReadAll IPS = Split(IPS, vbCrLf) […]

  • Using WMI to realize system patch detection and analysis

    Time:2020-4-14

    WMI is the core of Windows 2000 / XP management system; for other Win32 operating systems, WMI is a useful plug-in. WMI is based on cimom, which is the common information model object manager. It is an object database that describes the components of the operating system. It provides a common interface for MMC and […]

  • Rcmd.vbs [remote CMD with WMI] remote script

    Time:2020-3-19

    Copy codeThe code is as follows: 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.ScriptFullName&Chr(34)) Wscript.Quit End If If Wscript.arguments.Count<4 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_ […]

  • WMI script master incomplete manual

    Time:2020-3-8

    Windows management instrumentation is a core Windows Management Technology; users can use WMI to manage local and remote computers. WMI provides a continuous and consistent way for daily management through programming and scripting languages. Users can:1. Start a process on the remote computing machine.2. Set a process to run on a specific date and time.3. […]

  • VBS calls WMI to search hard disk MP3 files

    Time:2019-12-29

    Copy codeThe code is as follows: strComputer = “.” Set objWMIService = GetObject(“winmgmts:” _ & “{impersonationLevel=impersonate}!\\” _ & strComputer & “\root\cimv2”) Set colFiles = objWMIService. _ ExecQuery(“Select * from CIM_DataFile where Extension = ‘mp3′”) For Each objFile in colFiles Wscript.Echo objFile.Name Next Top upExecQuery(“Select * from CIM_DataFile where Extension = ‘mp3′”) Replace the MP3 in […]