Need Help With Batch File Script Not Working.

Discussion in 'Software' started by Anon-469e6fb48c, Jan 4, 2018.

  1. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    Need help with this script.It is for WMI errors,I have looked at other threads and it does not seem to work in windows 7.


    This Batch file is not running.


    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\subscription")


    Set obj1 = objWMIService.Get("__EventFilter.Name='BVTFilter'")

    set obj2set = obj1.Associators_("__FilterToConsumerBinding")

    set obj3set = obj1.References_("__FilterToConsumerBinding")



    For each obj2 in obj2set
    WScript.echo "Deleting the object"
    WScript.echo obj2.GetObjectText_
    obj2.Delete_
    next

    For each obj3 in obj3set
    WScript.echo "Deleting the object"
    WScript.echo obj3.GetObjectText_
    obj3.Delete_
    next

    WScript.echo "Deleting the object"
    WScript.echo obj1.GetObjectText_
    obj1.Delete_
     
  2. GermanOne

    GermanOne Guest

    It's not a Batch script but a VBScript. VBScripts are ASCII text files with extension .vbs instead of .txt.
     
    TimW likes this.
  3. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    Any idea how I can get it to work.I have tried Microsoft's website but it doesn't want to work.
     
  4. _nullptr

    _nullptr Major Geeky Geek Geek

    Could you elaborate on how you are trying to run the vbscript and what isn't working?
    What are you hoping that this script will fix?
     
  5. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    Last edited: Jan 5, 2018
  6. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    28817 01:33:33 (0) ** WMIDiag v2.2 started on Friday, January 05, 2018 at 01:29.
    28818 01:33:33 (0) **
    28819 01:33:33 (0) ** Copyright (c) Microsoft Corporation. All rights reserved - July 2007.
    28820 01:33:33 (0) **
    28821 01:33:33 (0) ** This script is not supported under any Microsoft standard support program or service.
    28822 01:33:33 (0) ** The script is provided AS IS without warranty of any kind. Microsoft further disclaims all
    28823 01:33:33 (0) ** implied warranties including, without limitation, any implied warranties of merchantability
    28824 01:33:33 (0) ** or of fitness for a particular purpose. The entire risk arising out of the use or performance
    28825 01:33:33 (0) ** of the scripts and documentation remains with you. In no event shall Microsoft, its authors,
    28826 01:33:33 (0) ** or anyone else involved in the creation, production, or delivery of the script be liable for
    28827 01:33:33 (0) ** any damages whatsoever (including, without limitation, damages for loss of business profits,
    28828 01:33:33 (0) ** business interruption, loss of business information, or other pecuniary loss) arising out of
    28829 01:33:33 (0) ** the use of or inability to use the script or documentation, even if Microsoft has been advised
    28830 01:33:33 (0) ** of the possibility of such damages.
    28831 01:33:33 (0) **
    28832 01:33:33 (0) **
    28833 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28834 01:33:33 (0) ** ----------------------------------------------------- WMI REPORT: BEGIN ----------------------------------------------------------
    28835 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28836 01:33:33 (0) **
    28837 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28838 01:33:33 (0) ** Windows 7 - Service Pack 1 - 64-bit (7601) - User 'CLUBSPY-PC\CLUBSPY' on computer 'CLUBSPY-PC'.
    28839 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28840 01:33:33 (0) ** INFO: Environment: .................................................................................................. 1 ITEM(S)!
    28841 01:33:33 (0) ** INFO: => 7 possible incorrect shutdown(s) detected on:
    28842 01:33:33 (0) ** - Shutdown on 03 January 2018 18:10:37 (GMT-0).
    28843 01:33:33 (0) ** - Shutdown on 03 January 2018 21:16:23 (GMT-0).
    28844 01:33:33 (0) ** - Shutdown on 04 January 2018 10:41:30 (GMT-0).
    28845 01:33:33 (0) ** - Shutdown on 04 January 2018 12:54:06 (GMT-0).
    28846 01:33:33 (0) ** - Shutdown on 04 January 2018 13:32:02 (GMT-0).
    28847 01:33:33 (0) ** - Shutdown on 04 January 2018 14:49:52 (GMT-0).
    28848 01:33:33 (0) ** - Shutdown on 05 January 2018 00:00:02 (GMT-0).
    28849 01:33:33 (0) **
    28850 01:33:33 (0) ** System drive: ....................................................................................................... C: (Disk #1 Partition #0).
    28851 01:33:33 (0) ** Drive type: ......................................................................................................... IDE (KINGSTON SUV400S37240G ATA Device).
    28852 01:33:33 (0) ** There are no missing WMI system files: .............................................................................. OK.
    28853 01:33:33 (0) ** There are no missing WMI repository files: .......................................................................... OK.
    28854 01:33:33 (0) ** WMI repository state: ............................................................................................... N/A.
    28855 01:33:33 (0) ** AFTER running WMIDiag:
    28856 01:33:33 (0) ** The WMI repository has a size of: ................................................................................... 19 MB.
    28857 01:33:33 (0) ** - Disk free space on 'C:': .......................................................................................... 167536 MB.
    28858 01:33:33 (0) ** - INDEX.BTR, 4530176 bytes, 1/5/2018 1:31:34 AM
    28859 01:33:33 (0) ** - MAPPING1.MAP, 50496 bytes, 1/4/2018 8:00:34 PM
    28860 01:33:33 (0) ** - MAPPING2.MAP, 50496 bytes, 1/5/2018 1:17:04 AM
    28861 01:33:33 (0) ** - OBJECTS.DATA, 15400960 bytes, 1/5/2018 1:31:34 AM
    28862 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28863 01:33:33 (0) ** INFO: Windows Firewall status: ...................................................................................... ENABLED.
    28864 01:33:33 (0) ** Windows Firewall Profile: ........................................................................................... PRIVATE.
    28865 01:33:33 (0) ** Inbound connections that do not match a rule BLOCKED: ............................................................... ENABLED.
    28866 01:33:33 (0) ** => This will prevent any WMI remote connectivity to this computer except
    28867 01:33:33 (0) ** if the following three inbound rules are ENABLED and non-BLOCKING:
    28868 01:33:33 (0) ** - 'Windows Management Instrumentation (DCOM-In)'
    28869 01:33:33 (0) ** - 'Windows Management Instrumentation (WMI-In)'
    28870 01:33:33 (0) ** - 'Windows Management Instrumentation (ASync-In)'
    28871 01:33:33 (0) ** Verify the reported status for each of these three inbound rules below.
    28872 01:33:33 (0) **
    28873 01:33:33 (0) ** Windows Firewall 'Windows Management Instrumentation (WMI)' group rule: ............................................. DISABLED.
    28874 01:33:33 (0) ** => This will prevent any WMI remote connectivity to/from this machine.
    28875 01:33:33 (0) ** - You can adjust the configuration by executing the following command:
    28876 01:33:33 (0) ** i.e. 'NETSH.EXE ADVFIREWALL FIREWALL SET RULE GROUP="Windows Management Instrumentation (WMI)" NEW ENABLE=YES'
    28877 01:33:33 (0) ** Note: With this command all inbound and outbound WMI rules are activated at once!
    28878 01:33:33 (0) ** You can also enable each individual rule instead of activating the group rule.
    28879 01:33:33 (0) **
    28880 01:33:33 (0) ** Windows Firewall 'Windows Management Instrumentation (DCOM-In)' rule: ............................................... DISABLED.
    28881 01:33:33 (0) ** => This will prevent any DCOM WMI inbound connectivity to this machine.
    28882 01:33:33 (0) ** Note: The rule 'Windows Management Instrumentation (DCOM-In)' rule must be ENABLED to allow incoming DCOM WMI connectivity.
    28883 01:33:33 (0) ** - You can adjust the configuration of this rule by executing the following command:
    28884 01:33:33 (0) ** i.e. 'NETSH.EXE ADVFIREWALL FIREWALL SET RULE NAME="Windows Management Instrumentation (DCOM-In)" NEW ENABLE=YES'
    28885 01:33:33 (0) **
    28886 01:33:33 (0) ** Windows Firewall 'Windows Management Instrumentation (WMI-In)' rule: ................................................ DISABLED.
    28887 01:33:33 (0) ** => This will prevent any WMI inbound connectivity to this machine.
    28888 01:33:33 (0) ** Note: The rule 'Windows Management Instrumentation (WMI-In)' rule must be ENABLED to allow incoming WMI connectivity.
    28889 01:33:33 (0) ** - You can adjust the configuration of this rule by executing the following command:
    28890 01:33:33 (0) ** i.e. 'NETSH.EXE ADVFIREWALL FIREWALL SET RULE NAME="Windows Management Instrumentation (WMI-In)" NEW ENABLE=YES'
    28891 01:33:33 (0) **
    28892 01:33:33 (0) ** Windows Firewall 'Windows Management Instrumentation (WMI-Out)' rule: ............................................... DISABLED.
    28893 01:33:33 (0) ** => This will prevent any WMI asynchronous outbound connectivity from this machine.
    28894 01:33:33 (0) ** - You can adjust the configuration of this rule by executing the following command:
    28895 01:33:33 (0) ** i.e. 'NETSH.EXE ADVFIREWALL FIREWALL SET RULE NAME="Windows Management Instrumentation (WMI-Out)" NEW ENABLE=YES'
    28896 01:33:33 (0) **
    28897 01:33:33 (0) ** Windows Firewall 'Windows Management Instrumentation (ASync-In)' rule: .............................................. DISABLED.
    28898 01:33:33 (0) ** => This will prevent any WMI asynchronous inbound connectivity to this machine.
    28899 01:33:33 (0) ** - You can adjust the configuration of this rule by executing the following command:
    28900 01:33:33 (0) ** i.e. 'NETSH.EXE ADVFIREWALL FIREWALL SET RULE NAME="Windows Management Instrumentation (ASync-In)" NEW ENABLE=YES'
    28901 01:33:33 (0) **
    28902 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28903 01:33:33 (0) ** DCOM Status: ........................................................................................................ OK.
    28904 01:33:33 (0) ** WMI registry setup: ................................................................................................. OK.
    28905 01:33:33 (0) ** INFO: WMI service has dependents: ................................................................................... 2 SERVICE(S)!
    28906 01:33:33 (0) ** - Security Center (WSCSVC, StartMode='Automatic')
    28907 01:33:33 (0) ** - Internet Connection Sharing (ICS) (SHAREDACCESS, StartMode='Disabled')
    28908 01:33:33 (0) ** => If the WMI service is stopped, the listed service(s) will have to be stopped as well.
    28909 01:33:33 (0) ** Note: If the service is marked with (*), it means that the service/application uses WMI but
    28910 01:33:33 (0) ** there is no hard dependency on WMI. However, if the WMI service is stopped,
    28911 01:33:33 (0) ** this can prevent the service/application to work as expected.
    28912 01:33:33 (0) **
    28913 01:33:33 (0) ** RPCSS service: ...................................................................................................... OK (Already started).
    28914 01:33:33 (0) ** WINMGMT service: .................................................................................................... OK (Already started).
    28915 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28916 01:33:33 (0) ** WMI service DCOM setup: ............................................................................................. OK.
    28917 01:33:33 (2) !! WARNING: WMI DCOM components registration is missing for the following EXE/DLLs: .................................... 2 WARNING(S)!
    28918 01:33:33 (0) ** - C:\WINDOWS\SYSTEM32\WBEM\IPMIPRV.DLL (\CLSID\{FD209E2E-813B-41C0-8646-4C3E9C917511}\InProcServer32)
    28919 01:33:33 (0) ** - C:\WINDOWS\SYSTEM32\WBEM\SERVERCOMPPROV.DLL (\CLSID\{9042E1B1-8FD4-4008-89FE-4040CC74575A}\InProcServer32)
    28920 01:33:33 (0) ** => WMI System components are not properly registered as COM objects, which could make WMI to
    28921 01:33:33 (0) ** fail depending on the operation requested.
    28922 01:33:33 (0) ** => For a .DLL, you can correct the DCOM configuration by executing the 'REGSVR32.EXE <Filename.DLL>' command.
    28923 01:33:33 (0) **
    28924 01:33:33 (0) ** WMI ProgID registrations: ........................................................................................... OK.
    28925 01:33:33 (0) ** WMI provider DCOM registrations: .................................................................................... OK.
    28926 01:33:33 (0) ** WMI provider CIM registrations: ..................................................................................... OK.
    28927 01:33:33 (0) ** WMI provider CLSIDs: ................................................................................................ OK.
    28928 01:33:33 (0) ** WMI providers EXE/DLL availability: ................................................................................. OK.
    28929 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28930 01:33:33 (0) ** INFO: User Account Control (UAC): ................................................................................... DISABLED.
    28931 01:33:33 (0) ** INFO: Local Account Filtering: ...................................................................................... ENABLED.
    28932 01:33:33 (0) ** => WMI tasks remotely accessing WMI information on this computer and requiring Administrative
    28933 01:33:33 (0) ** privileges MUST use a DOMAIN account part of the Local Administrators group of this computer
    28934 01:33:33 (0) ** to ensure that administrative privileges are granted. If a Local User account is used for remote
    28935 01:33:33 (0) ** accesses, it will be reduced to a plain user (filtered token), even if it is part of the Local Administrators group.
    28936 01:33:33 (0) **
    28937 01:33:33 (0) ** Overall DCOM security status: ....................................................................................... OK.
    28938 01:33:33 (0) ** Overall WMI security status: ........................................................................................ OK.
    28939 01:33:33 (0) ** - Started at 'Root' --------------------------------------------------------------------------------------------------------------
    28940 01:33:33 (0) ** INFO: WMI permanent SUBSCRIPTION(S): ................................................................................ 2.
    28941 01:33:33 (0) ** - ROOT/SUBSCRIPTION, CommandLineEventConsumer.Name="BVTConsumer".
    28942 01:33:33 (0) ** 'SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99'
    28943 01:33:33 (0) ** - ROOT/SUBSCRIPTION, NTEventLogEventConsumer.Name="SCM Event Log Consumer".
    28944 01:33:33 (0) ** 'select * from MSFT_SCMEventLogEvent'
    28945 01:33:33 (0) **
    28946 01:33:33 (0) ** WMI TIMER instruction(s): ........................................................................................... NONE.
    28947 01:33:33 (0) ** INFO: WMI namespace(s) requiring PACKET PRIVACY: .................................................................... 4 NAMESPACE(S)!
    28948 01:33:33 (0) ** - ROOT/CIMV2/SECURITY/MICROSOFTTPM.
    28949 01:33:33 (0) ** - ROOT/CIMV2/SECURITY/MICROSOFTVOLUMEENCRYPTION.
    28950 01:33:33 (0) ** - ROOT/CIMV2/TERMINALSERVICES.
    28951 01:33:33 (0) ** - ROOT/SERVICEMODEL.
    28952 01:33:33 (0) ** => When remotely connecting, the namespace(s) listed require(s) the WMI client to
    28953 01:33:33 (0) ** use an encrypted connection by specifying the PACKET PRIVACY authentication level.
    28954 01:33:33 (0) ** (RPC_C_AUTHN_LEVEL_PKT_PRIVACY or PktPrivacy flags)
    28955 01:33:33 (0) ** i.e. 'WMIC.EXE /NODE:"CLUBSPY-PC" /AUTHLEVEL:pktprivacy /NAMESPACE:\\ROOT\SERVICEMODEL Class __SystemSecurity'
    28956 01:33:33 (0) **
    28957 01:33:33 (0) ** WMI MONIKER CONNECTIONS: ............................................................................................ OK.
    28958 01:33:33 (0) ** WMI CONNECTIONS: .................................................................................................... OK.
    28959 01:33:33 (0) ** WMI GET operations: ................................................................................................. OK.
    28960 01:33:33 (0) ** WMI MOF representations: ............................................................................................ OK.
    28961 01:33:33 (0) ** WMI QUALIFIER access operations: .................................................................................... OK.
    28962 01:33:33 (0) ** WMI ENUMERATION operations: ......................................................................................... OK.
    28963 01:33:33 (0) ** WMI EXECQUERY operations: ........................................................................................... OK.
    28964 01:33:33 (0) ** WMI GET VALUE operations: ........................................................................................... OK.
    28965 01:33:33 (0) ** WMI WRITE operations: ............................................................................................... NOT TESTED.
    28966 01:33:33 (0) ** WMI PUT operations: ................................................................................................. NOT TESTED.
    28967 01:33:33 (0) ** WMI DELETE operations: .............................................................................................. NOT TESTED.
    28968 01:33:33 (0) ** WMI static instances retrieved: ..................................................................................... 1758.
    28969 01:33:33 (0) ** WMI dynamic instances retrieved: .................................................................................... 0.
    28970 01:33:33 (0) ** WMI instance request cancellations (to limit performance impact): ................................................... 1.
    28971 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28972 01:33:33 (0) ** # of Event Log events BEFORE WMIDiag execution since the last 20 day(s):
    28973 01:33:33 (0) ** DCOM: ............................................................................................................. 0.
    28974 01:33:33 (0) ** WINMGMT: .......................................................................................................... 0.
    28975 01:33:33 (0) ** WMIADAPTER: ....................................................................................................... 0.
    28976 01:33:33 (0) **
    28977 01:33:33 (0) ** # of additional Event Log events AFTER WMIDiag execution:
    28978 01:33:33 (0) ** DCOM: ............................................................................................................. 0.
    28979 01:33:33 (0) ** WINMGMT: .......................................................................................................... 0.
    28980 01:33:33 (0) ** WMIADAPTER: ....................................................................................................... 0.
    28981 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28982 01:33:33 (0) ** WMI Registry key setup: ............................................................................................. OK.
    28983 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28984 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28985 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28986 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28987 01:33:33 (0) **
    28988 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28989 01:33:33 (0) ** ------------------------------------------------------ WMI REPORT: END -----------------------------------------------------------
    28990 01:33:33 (0) ** ----------------------------------------------------------------------------------------------------------------------------------
    28991 01:33:33 (0) **
    28992 01:33:33 (0) ** WARNING: WMIDiag determined that WMI works CORRECTLY. HOWEVER, some issues were detected. Check 'C:\USERS\CLUBSPY\APPDATA\LOCAL\TEMP\WMIDIAG-V2.2_WIN7_.CLI.SP1.64_CLUBSPY-PC_2018.01.05_01.29.00.LOG' for details.
    28993 01:33:33 (0) **
    28994 01:33:33 (0) ** WMIDiag v2.2 ended on Friday, January 05, 2018 at 01:33 (W:62 E:7 S:2).
     
  7. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

  8. GermanOne

    GermanOne Guest

    I'm not willing to read MBs of log files if I don't even know what exactly the problem is that you have.

    WHAT doesn't work? Does the script even run? If it runs, does a message pop up indicating that an error occurred? If so, the message contains the line number and character position where the error occurred. What does it point to?

    Please say with your own words what the issue is. Does WMI generally not work because e.g. the service doesn't run or is it only the specific script you posted above?
     
  9. GermanOne

    GermanOne Guest

    This is a Batch code that should fix you problems in case WMI doesn't work in general. I read in your log that some DLLs are not registered correctly.

    Save this code as ASCII text file with exension .bat instead of .txt, close any programs (because your computer has to be rebooted) and run the script. Not sure if you will be prompted to run the script elevated because you have the UAC turned off (which is your safety risk btw.).

    Code:
    @if (@a)==(@b) @end /*
    @echo off &setlocal EnableExtensions DisableDelayedExpansion
    
    >nul 2>&1 net session || (
      cscript //nologo //e:jscript "%~fs0" "%~f0"
      exit /b
    )
    
    sc config winmgmt start= disabled
    net stop winmgmt /y
    
    pushd "%SystemRoot%\System32\wbem"
    if errorlevel 1 (
      sc config winmgmt start= auto
      echo Unable to change the working directory.
      pause
      goto :eof
    )
    for /f %%i in ('dir /a-d /b *.dll') do regsvr32 /s "%%i"
    WmiPrvSE.exe /regserver
    popd
    
    rd /s /q "%SystemRoot%\System32\wbem\repository"
    
    sc config winmgmt start= auto
    
    echo(
    pause>nul|set /p "=Your PC has to be rebooted, press any key ... "&echo(
    
    shutdown /r
    exit /b
    
    */ WScript.CreateObject('Shell.Application').ShellExecute('cmd.exe', '/c "' + WScript.Arguments(0) + '"', '', 'runas', 1);
    My former questions still need to be answered.
     
  10. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    I think it keeps rebooting my system.

    I have ran multiple test and scans and even installed windows a few times.And there are no hidden virus or malware attached to my system.

    I keep getting WMI errors in my event log.I am trying to figure out why my system keeps rebooting for unknown reasons.I even replaced my power supply.

    Capture.PNG
     
  11. Anon-469e6fb48c

    Anon-469e6fb48c Anonymized

    Do you know what DLLs are not working.
     
  12. Eldon

    Eldon Major Geek Extraordinaire

  13. GermanOne

    GermanOne Guest

    Yes, just read your own log file. It tells you what DLLs are not registered properly. My Batch script should have fixed it.

    Actually I didn't want to answer anymore. No information if you run my Batch script, no answer to my questions even if I explicitely stated that they have to be answered. I don't have a crystal ball and that's why I give up. Good luck.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds