Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:49:03+00:00 2026-06-11T11:49:03+00:00

So basically, all I want to do is execute an sc command on 100

  • 0

So basically, all I want to do is execute an “sc” command on 100 servers whose names are mentioned in a text file “server.txt”. I tried the following and it doesnt work as it returns empty notepad file.

for /f %%a in (servers.txt) do sc \\server_name query | find "SERVICE_NAME">>servicecontroller.txt

I tried the above command locally and it worked just fine. I know the issue is in the “\server_name”. Not sure what about it is wrong. Do i need to use the hidden shares?
Like this maybe?

\\server_name\c$ /user:domain\username password    

Or like this?

 \\server_name\c$
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:49:04+00:00Added an answer on June 11, 2026 at 11:49 am

    If you’ve hardcoded \\server_name there rather than %%a, then that’s your problem. Try this instead:

    for /f %%a in (servers.txt) do sc \\%a query | find "SERVICE_NAME">>servicescontroller.txt
    

    EDIT :
    The following line helps in getting admin access consistently on all the servers. This is the line I(OP) was looking for.

    net use \\servername\ipc$ /u:domain\user password
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I want to read and write to a file then save all the
I basically want the same functionality as facebook, twitter and all those other infinite
Basically, I want to get all rows from the customers table that do NOT
I want to get all the Applications that have intentlisteners to Intent.CATEGORY_HOME so basically
Basically, I want to get a list of all installed apps and pick one
I want to find all strings containing at least 1 Cyrillic character (basically /.*[А-я].*/)
I have been stumped all day on this problem. Basically I want to check
Basically I want start a few threads which execute serially one after the another.
Please see #7755661 first. I am using ECL and basically want to execute some
Basically all pages on this site I am building cannot be accessed when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.