Extract only perticular data from excel coulmn by using powershell

Abhishek Reddy 61 Reputation points
2021-10-25T06:34:18.557+00:00

Requirement is to fetch only name of service by cutting down before and after period, AAA.BBB.CCC is the service name which is writing to excel so while importing that excel we need to have trimmed it to display only BBB.

Please help here

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,383 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,096 Reputation points
    2021-10-25T14:24:38.463+00:00

    Try changing that "select" cmdlet to:

    $res | Select-Object @{n='ServiceName';e={($_.ServiceName -split "\.")[1]}}, Status, MachineName
    
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. SChalakov 10,261 Reputation points MVP
    2021-10-25T09:41:48.68+00:00

    Hey,

    can you please post the script you have written? Please explain what is not working, what the challenges are?

    Thanks in advnace!

    Regards,
    Stoyan