Yes I agree disabling winmgmt will break many things.. it was just an use for testing purpose..
Thanks for your input... sorry I think I haven't explain properly....
Your script works perfectly fine but it will show all 500 machines services as disabled even if it was disabled before and everytime I run batch it will show again success message.... That was the reason of checking if service is enable then only disable it and show machine name in log output.
Idea is to....
1. Check service running
2. Disable if it's running
3. Give machine name in logfile with date if possible..... output.txt
I found something similar... but it's other way around..
set service = uvnc_service
for /F %%a in (c:\find.txt) do call :servicecheck %%a
sc \\%1 query %service% | FIND "RUNNING"
IF %ERRORLEVEL% == 1 GOTO STARTSERVICE %1
sc \\%1 start %service% && >> out.txt echo %1