Jump to content

Recommended Posts

Posted

Im scripting a WMIC batch job which will run against a list of live servers and services, it will list out the required servers and output them too a CSV file. Now thats simple but the output needs to be auto sorted in a spreadsheet when opened, not like this (service,type,running,auto,etc).

Is there a why for this to be done as there will be another one created that should compare the 2 spreadsheets and display the differances for powerdowns etc.

Cheers guys and gals

Rob


Posted

There are always a host of ways of preforming tasks, however, you cannot change the output order from the WMIC command. You would need to use another method of obtaining the data or sort the data from the output prior to importing it.

It is a two way process, I am not going to provide suggestions or solutions with insufficient information, so you'll need to fulfil that side of the process.

Posted

Hi,

This is the WMIC output in CSV format...

Node,Caption,StartMode,State,Status

TSER-RKER-01,ASF Agent,Auto,Running,OK

In order to have them comma seperated within Excel then the app needs to be open and Text to Columns needs to be played with. This is the output im after...

Node Caption StartMode State Status

TSER-RKER-01 ASF Agent Auto Running OK

Posted

Using double quote to enclose each value should solve then excel csv open problem.

"TSER-RKER-01","ASF Agent","Auto","Running","OK"

Posted

You're still not really helping me much here!

What are you wanting to be output?

Is your requirement tab or space delimited as opposed to comma?

Why are you using WMIC as opposed to other methods?

What operating system(s)?

What is the exact command line you are using?

I asked for information and what you've supplied is very little. These things go a lot easier if we don't keep on providing you with answers then wait for you to give us reasons why it will not work for you. If you provide us with as much as possible to begin with it saves us wasting our time pointlessly.

Posted

A simple command which displays certain services within a file listing of servers...

wmic /output:"e:\scripts\service check\test\Services_Before.csv" /NODE:@"e:\scripts\service check\test\servers.txt" /failfast:on service where (name="clipsrv" or name="asfagent" or name="alg") get caption,startmode, state, status /format:csv

The output is within one excel cell and has to be manually edited via excel to seperate the comma delimiters, once this is done another script runs and produces an after csv file, this file is then compared to the first and any differances are highlighted.

Im trying to automate the output so that the end user doesn't have to manually edit the file and when opened it will already be seperated.

OS's are Windows 2000/2003/2008

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...