String output manipualtion

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Daniel Krebs Daniel Krebs 5 days, 7 hours ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #54417
    Profile photo of Russ J
    Russ J
    Participant

    Hi

    This is an easy one for you Powershell guns, I don't use powershell too much and I'm not across it as much as I'd like...

    so if I run the command

    GWMI Win32_OperatingSystem | select name

    I get the below

    "Microsoft Windows Server 2008 R2 Enterprise |C:\Windows|\Device\Harddisk0\Partition1"

    What if I only want Microsoft Windows Server 2008 R2 Enterprise. How do I do it?

    p.s. Yes I understand there is another property 'caption' that only has 'Microsoft Windows Server 2008 R2 Enterprise'. This is more about the process of manipulating output.

    Thanks all.

    #54420
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    I've created a short script showing different options to extract the desired text from the property.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.