Newbie Question: Basic select-object Question.

powershell

    Next

  • 1. comparing dates to $null
    I'm trying to find records matching a date within a certain amount of time. Some of the source fields have no date specified and are instead $null. As a result, I get some obvious errors. What is the best way to structure my queries to avoid this error? snippet: $recentXpu = $xpu | ? { $_.StartDate -ge [DateTime]::Now.AddDays(-60) } error: At line:1 char:41 + $recentXpu = $xpu | ? { $_.StartDate -ge <<<< [DateTime]::Now.AddDays(-60) } The '-ge' operator failed: Could not compare "" to "6/28/2007 11:10:51 AM". Error: "Cannot conver t value "6/28/2007 11:10:51 AM" to type "System.DBNull". Error: "Object cannot be cast to DBNull. "". >From my point of view, the error is irrelevant--obviously if the date is $null it doesn't fit my criteria and should be tossed out. I'd like to comfortably stay within one-liner territory which is where I'm stalled.
  • 2. hi, i want to recieve the toc of an iso file..
    hi, how can i get the toc of a iso file
  • 3. Copy Con - is there something like this
    Just exploring and learning (and I know I have a long way to go) so I hope this question is appropriate. A lot of times in creating batch files or scripts I would use the copy con filename.ext to create very quickly the contents of perhaps the actual command file OR the data file needed to test a script on. Example: C:>copy con mytest.bat @echo off echo Running my test.bat file echo. echo Hello world! echo. pause <ctrl-Z><CR> 1 file(s) copied C:> Anyway I always like the quick and easy way of creating files like this so I'm wondering if there is something equalivant in powershell. TIA! JB

Newbie Question: Basic select-object Question.

Postby No Spam » Wed, 07 Oct 2009 15:15:19 GMT

Newbie alert.

Hi,

I am still a beginner at this, so excuse this basic question if it was
answered.
I read the docs, search through google and cannot find an answer to
this.

How to I capture the string only from the select-object output.

For example.


Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    141      23    30480      27500   546     0.45   4928 GOContactSync

I would like to capture the process name only.



ProcessName
-----------
GOContactSync

How do I capture the value only "GOContactSync" and not the
"ProcessName" headline?

Any pointers would be greatly appreciated.

Thanks.


Re: Newbie Question: Basic select-object Question.

Postby Peter Schneider » Wed, 07 Oct 2009 15:43:56 GMT

Try the following:

(get-process -name g*).ProcessName

or

$p = get-process -name g* | select-object ProcessName
$p.ProcessName

greetings, Peter Schneider

"No Spam" < XXXX@XXXXX.COM > schrieb im Newsbeitrag 



RE: Newbie Question: Basic select-object Question.

Postby cmFiMzY » Wed, 07 Oct 2009 15:53:01 GMT


Hi,

Get-Process g*

returns a collection of process objects with names that start with g

Select-Object converts each object of this collection to a new custom object 
with the single property ProcessName that is copied from the original process 
objects.

To investigate this try

 (Get-Process g* | Select-Object ProcessName).GetType()

and

Get-Process g* | Select-Object ProcessName | Get-Member

With the standard formatting the reduced object produces your result.

Try

Get-Process g* | ForEach-Object { $_.ProcessName }

to get a string for every process that starts with g.

To get the first process only that starts with g you can use

Get-Process p* | Select-Object -First 1 | ForEach-Object { $_.ProcessName }

-- 
Bernd






Re: Newbie Question: Basic select-object Question.

Postby No Spam » Thu, 08 Oct 2009 02:37:18 GMT

Thank you very much.



In article <# XXXX@XXXXX.COM > 





Re: Newbie Question: Basic select-object Question.

Postby No Spam » Thu, 08 Oct 2009 02:38:03 GMT

In article < XXXX@XXXXX.COM > 





Thank you very much for your time and explanation.
Much appreciated.

Similar Threads:

1.Basic question/confirmation - Another basic question.

2.Newbie with some basic questions.

I'm a newbie to multimedia and streaming servers. I have some basic 
questions I'm hoping people can answer:

I have an XP box that has access to several live muLaw audio streams. 
(Single channel 8000 samples per second.) The box also has a data stream 
that describes the audio. There are several hundred different descriptors 
that can appear for any of the audio streams. My ultimate goal is to have a 
client web interface to stipulate which descriptor interests the operator. 
Based on data from the data stream, when audio for that descriptor is 
present I want to stream the audio to the web page user.

I envision my XP box handling the data stream and routing appropriate audio 
to the encoder running on the XP box. The encoder will push the encoded data 
to a second box running Windows server 2003 which would stream the audio to 
the user. I need to support at most 8 simultaneous users which may be 
accessing 1 to 8 different streams. (Some users may want the same stream.)

My client wants me to use Microsoft products with an embedded Microsoft 
Media player.

QUESTIONS:

1) Is this two box approach a good idea?

2) Other then having to purchase the two different operating systems, is 
there any other cost? Licensing?

3) What time lag can I expect in the live presentation? About how long will 
it take to encode a live stream of muLaw data, push to the server, stream to 
the client web page on a local network, and play on the player. I'd minimize 
buffers if I can do that. What kinda of time lag should I expect. 2 seconds? 
(Or am I dreaming?)

4) My program on the XP box is written in Visual C++ Version 6. Will that 
work? (I can use .net if needed. I rather not, so that I can minimize the 
number of new things I'm learning.) I'll be connecting to the encoder SDK. 
Right??? What type of interface is used?

5) For each web client, I envision establishing an audio stream. At any 
given instant the XP box will provide either appropriate live audio or 
silence. The audio selection will be based on the web client's choice from a 
list of several hundred different audio choices. Is this concept solid?

6) I need a way to communicate the web clients selection to my XP box so 
that I can render the correct audio. Is there a way to get that info through 
the server and back to the XP box?

7) Some of the audio selections come in short spurts. Say 10 seconds of 
audio at a time with gaps of silence between the audio ranging from a few 
seconds to a few minutes or maybe even an hour or two. If I am streaming 
this, will this work? Will there be any problem for the player if there are 
these long gaps of silence?


Thanks to anyone willing to help me...


3.Basic questions about Web Parts and SharePoint Services (newbie)

I just read the excellent MSDN article "A Developer's Introduction to Web
Parts" by Andy Baron (May 2003).

Looks like something we might want to use in an upcoming product, but I have
some basic questions:

1) what's changed regarding Web Parts or SharePoint Services in the past
year?  Is the article still technically up-to-date?

2) do I need the SharePoint Portal Server in order to use the sample
solution described in the article?  Or do I only need a W2K3 Server with
SharePoint Services?

3) how drastically will ASP.NET V2 (Whidbey) change the implementation of
Web Parts?  Will Whidbey still require Web Parts to be written as Custom
Controls, and (in particular) still require us to write our own code to emit
HTML ?  In short, how much less work would we have to do if we waited for
Whidbey (which is due out when???).

BTW: what's the best group for Web Parts devl questions?

David Thom
NPSi Houston




4.basic question from a newbie

Hello,

I am running Win2k Pro as my peer server for my computer consulting business. I've been using remote desktop to connect to a client's computer to do off-site work for them. It really makes life easier for me, since the client is on the opposite side of the country.

I've been told that I can set up my own Win2k Pro machine as a terminal server so I can log in when on the road and check my email, send letters, etc. from my laptop.

I see lots of help on setting up a client and see articles and FAQs on TS licensing and CALs, but I don't see anyplace (including in the Win2k Pro documentation) where I can download and install the terminal server app itself.

My client told me (and perhaps incorrectly) that the Pro license allows a personal use connection to run terminal server on Win2k. If this is true, where do I download and/or license it? I can't find anyplace on the MS site for this - I only find the client portion for downloading. Any suggestions where I can start?

Or should I just buy one of the third party products like GoToMyPC or PCAnywhere or set up some other VPN connection. Please help me with a simple, easily deployable solution. Thank you in advance.

Joe Giaquinto

5.Basic Question for IE 6.0 Newbie...

I'm getting used to using IE 6.0 in a work environment, 
but something is making browsing a real pain so I need 
help please !?

When you click on the favorites menu, it drops down a 
list of bookmarked faves but the menu only shows a few of 
them and has two of these.. ^ ..but upside down and bold. 
When I click on them they expand to show the entire faves 
list, but I find it quite annoying !

How do I turn if off ?? Probably very basic, but I'm 
getting frustrated !

Thank you...

6. Some basic Newbie questions......

7. Newbie - Most basic Help Question

8. Basic server question (newbie)



Return to powershell

 

Who is online

Users browsing this forum: No registered users and 6 guest