Reset Network Data Usage in Windows 10  

Page 4 of 7 FirstFirst ... 23456 ... LastLast
  1. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #30

    pewe said:
    If anyone wanted to use this,

    - do you mind?
    - how would the script be run ? (forgive the ignorance of a non-coder)

    Please advise


    Thanks
    Hi,

    Just copy the code to a new text file then change the file extension from .txt to .bat, then just double click it to run.

    Please post back if the script works.
      My Computer


  2. Posts : 86
    Win 10 pro
       #31

    Polo6RGTI said:
    Hi,

    Just copy the code to a new text file then change the file extension from .txt to .bat, then just double click it to run.

    Please post back if the script works.
    Ran it and the script window reported errors as follows

    Commensing with Data Usage Reset:

    Stopping Data Usage Services


    [SC] OpenService FAILED 1060:


    The specified service does not exist as an installed service.




    Resetting Data Usage


    Restarting Data Usage Services


    [SC] OpenService FAILED 1060:


    The specified service does not exist as an installed service.






    Data Usage was Reset to 0


    Press any key to exit.
    But the wifi (don't use the Network) usage was cleared - well it showed 0.23MB on resetting.
      My Computer

  3. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #32

    pewe said:
    Ran it and the script window reported errors as follows



    But the wifi (don't use the Network) usage was cleared - well it showed 0.23MB on resetting.
    What is the Build version of the Windows 10 installation on your computer?
      My Computer

  4. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #33

    @pewe please try this script. I have removed the command to disable the Data Usage service(DusmSvc).

    Code:
    @ECHO OFF
    :: BatchGotAdmin (Run as Admin code starts)
    REM --> Check for permissions
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    REM --> If error flag set, we do not have admin.
    if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
    ) else ( goto gotAdmin )
    :UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
    :gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
    :: BatchGotAdmin (Run as Admin code ends)
    :: Your codes should start from the following line
    COLOR 1F
    ECHO Commensing with Data Usage Reset:
    ECHO.
    ECHO Stopping Data Usage Services
    ECHO.
    net stop DusmSvc > NUL 2>&1
    net stop diagnosticshub.standardcollector.service > NUL 2>&1
    net stop DPS > NUL 2>&1
    ECHO.
    ECHO Resetting Data Usage
    echo Y | del /f /q "C:\Windows\System32\sru\*.*" > nul
    ECHO.
    ECHO Restarting Data Usage Services
    ECHO.
    net start DusmSvc > NUL 2>&1
    net start diagnosticshub.standardcollector.service > NUL 2>&1
    net start DPS > NUL 2>&1
    ECHO.
    ECHO.
    ECHO Data Usage was Reset to 0
    ECHO.
    ECHO Press any key to exit.
    pause > nul
    :end
      My Computer

  5. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #34

    pewe said:
    Ran it and the script window reported errors as follows



    But the wifi (don't use the Network) usage was cleared - well it showed 0.23MB on resetting.
    If you have a network adapter with an active connection the Data Usage counter will show "< 1 MB" or greater even right after running the Data Usage reset script.
      My Computer


  6. Posts : 86
    Win 10 pro
       #35

    Polo6RGTI said:
    @pewe please try this script. I have removed the command to disable the Data Usage service(DusmSvc).
    That did the trick.
      My Computer

  7. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #36

    I've updated the script. Only the Diagnostic Policy Service(DPS) is required to be stopped when resetting the Data Usage. I have also changed the wording that is displayed and the script will now also automatically exit when the task is completed. Any feedback will be appreciated.

    Code:
    @ECHO OFF
    :: BatchGotAdmin (Run as Admin code starts)
    REM --> Check for permissions
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    REM --> If error flag set, we do not have admin.
    if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
    ) else ( goto gotAdmin )
    :UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
    :gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
    :: BatchGotAdmin (Run as Admin code ends)
    :: Your codes should start from the following line
    COLOR 1F
    ECHO Commencing with Data Usage Reset:
    ECHO.
    ECHO Stopping Diagnostic Policy Service
    ECHO.
    net stop DPS > NUL 2>&1
    ECHO.
    ECHO Resetting Data Usage
    echo Y | del /f /q "C:\Windows\System32\sru\*.*" > nul
    ECHO.
    ECHO Restarting Diagnostic Policy Service
    ECHO.
    net start DPS > NUL 2>&1
    ECHO.
    ECHO Data Usage was Reset to 0
    ECHO.
    ECHO Closing in 5 Seconds....
    ping 127.0.0.1 -n 6 >nul 2>&1
    exit
      My Computer


  8. Posts : 86
    Win 10 pro
       #37

    Polo6RGTI said:
    I've updated the script. Only the Diagnostic Policy Service(DPS) is required to be stopped when resetting the Data Usage. I have also changed the wording that is displayed and the script will now also automatically exit when the task is completed. Any feedback will be appreciated.
    Worked nicely.

    I don't suppose it would be a simple task to record the stats to a file before clearing them - or is it???
    Something that could maybe be copied to a spreadsheet ??!!!!
      My Computer

  9. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #38

    pewe said:
    Worked nicely.

    I don't suppose it would be a simple task to record the stats to a file before clearing them - or is it???
    Something that could maybe be copied to a spreadsheet ??!!!!
    Hi,

    I have already started searching for commands to do exactly that or at least to a text file. I have no formal training in coding so it may take me a while to get it right.
      My Computer

  10. Polo6RGTI's Avatar
    Posts : 800
    Windows 10 Enterprise x64 19043.928
       #39

    I have updated the script again. I added a Y/N option and a color change when yes is selected.

    Code:
    @ECHO OFF
    :: BatchGotAdmin (Run as Admin code starts)
    REM --> Check for permissions
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    REM --> If error flag set, we do not have admin.
    if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
    ) else ( goto gotAdmin )
    :UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
    :gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
    :: BatchGotAdmin (Run as Admin code ends)
    :: Your codes should start from the following line
    COLOR 1F
    CHOICE /C:YN /M "Do you want to reset the Data Usage now?"
    IF ERRORLEVEL 2 goto no
    IF ERRORLEVEL 1 goto yes
    :yes
    COLOR 2F
    ECHO.
    ECHO Commencing with Data Usage Reset:
    ECHO.
    ECHO Stopping Diagnostic Policy Service
    ECHO.
    net stop DPS > NUL 2>&1
    ECHO Resetting Data Usage
    ECHO Y | del /f /q "C:\Windows\System32\sru\*.*" > nul
    ECHO.
    ECHO Restarting Diagnostic Policy Service
    ECHO.
    net start DPS > NUL 2>&1
    ECHO.
    CLS
    ECHO Data Usage was Reset to 0
    ECHO.
    ECHO Closing in 5 Seconds....
    ping 127.0.0.1 -n 6 >nul 2>&1
    exit
    :no
    exit
      My Computer


 
Page 4 of 7 FirstFirst ... 23456 ... LastLast

Tutorial Categories

Reset Network Data Usage in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 23:18.
Find Us




Windows 10 Forums