Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Serfer
Mar 10, 2003

The piss tape is real



Ok, I've got a problem. I have a datatable (returned data from an SQL query), and I need to count up the items that have the same of a single element.
So there are the following fields:

HostName DisplayName EntryDate Usages

and I need to count up all the items that have the same displayname. I understand essentially how it would be done (probably easiest would be a dynamic variable with the same name, that just gets incremented), but I'm unfamiliar with how these are actually done in Powershell.

Adbot
ADBOT LOVES YOU

Serfer
Mar 10, 2003

The piss tape is real



wwb posted:

Easiest way would be to have sql server do it actually- "SELECT COUNT(*) as ItemCount, HostName, DisplayName, EntryDate, Usages GROUP BY HostName" is a step in the right direction.
Well, it's not quite that simple, but that's essentially what I ended up doing.

Serfer
Mar 10, 2003

The piss tape is real



adaz posted:

Would you want to know blahblah was used twice, foobar three times, and snafu once?
Pretty much, yes

Serfer
Mar 10, 2003

The piss tape is real



How can I get my data back after using format list?

I'm using "get-eventlog -computername srv01 -logname system -source print -after $date"
and then piping through fl to get just a couple properties, but if I use convertto-csv after that, I just get a bunch of UUID's instead of the textual data. Obviously I'm just being stupid and there's something obvious that I'm overlooking.

Serfer
Mar 10, 2003

The piss tape is real



evil_bunnY posted:

Also, any program that can create 260+ chars paths needs to die in a fire. HAHA you can look at it, but you can't touch it!
Can you use \\?\c:\ (or whatever drive) to access it? Anything that can use UNC paths should be able to access it that way.

See also subst.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply