Questions tagged [select-object]

PowerShell cmdlet that selects objects or object properties.

The Select-Object cmdlet selects specified properties of an object or set of objects. It can also select unique objects, a specified number of objects, or objects in a specified position in an array.

https://technet.microsoft.com/en-us/library/hh849895.aspx

109 questions
0
votes
0 answers

Select statement return a collection rather than individual item - Powershell

I'm trying to grab and old Archive date to compare it to today to see when was the last time data was written to a certain table and present a report. However, I'm not able to break the LastArchivedDate collection and get individual…
Greg
  • 13
  • 3
0
votes
1 answer

Powershell displaying key against value using select-property

I am using additionalProperties in swagger because of which I am getting the output in the below format in powershell: Path: ABC Keys: {KeyX, KeyY} Values: {ValueOfX, ValueOfY} Count: 2 ... Is there any way that this…
Saniaaa
  • 35
  • 4
0
votes
1 answer

What does this powershell script do?

currently I watch the course about IT support and encountered this script: $FILE = $GET_HTML.Links | Select-Object @{Label='href'; Expression={@{$true=$_.href}[$_.href.EndsWith('win64.exe')]}} | Select-Object -ExpandProperty href I figured out that…
Mr. 13
  • 49
  • 5
0
votes
0 answers

PowerShell - Select-Object when the column header has a dynamic name

I am reading an CSV File in which, depending on the month, the column headers will have different names. They will always represent 3 months ago, 2 months ago, and 1 month ago, but will have column header names such as: Actuals(-3) Reg Hrs…
0
votes
0 answers

Calculate number of pixels for each resolution on each line, and sorting them by size

I am writing a skin for Rainmeter, that can change resolutions of a monitor. The Powershell measure in my Rainmeter skin, uses a command line utility to retrieve a list of possible resolutions. But I'm having trouble sorting the list (Largest to…
NotBot
  • 1
0
votes
2 answers

Is it possible to change the date format while exporting to CSV in PowerShell

I have a PowerShell script I run on a regular basis. Part of the script creates csv files that I later use to import data into various software programs. The data is in a variable $enrolledStudents and the type is a System.Array I use the following…
0
votes
0 answers

Using Select-Object from Scriptblock

Im quite new to PowerShell, I have 4 piped scripts, each with their own select statements, then i have a select-object after the scriptblock that selects all columns previously selected from the different statements in the scriptblock, I then use…
0
votes
0 answers

Powershell import-module string formatting

I am trying to import a Powershell module that's already installed but having an issue with passing the array from Get-Module and converting to the correct format to run Import-Module. To explain the first line, there are 2 modules that work…
0
votes
1 answer

Powershell - Search for Pattern and Copy

i have a bunch of *.CSV Files. Huge *.CSV Files. I try to search for a specific pattern in these Files called "Secure". If found, the script shall copy it to a folder. It works, but it has one Problem i could'nt solve. In some files, the Word i'm…
rzhell
  • 35
  • 5
0
votes
1 answer

How select-object cmdlet accepts input by pipeline?

Sorry for asking a novice question, as I am learning Powershell and I am confused how select-object -property parameter works with pipeline. As mentioned in help it doesnot accept the value through pipeline. For e.g: the below code should have given…
0
votes
1 answer

How To Query S3 Objects with CLI instead of S3 Select?

I need a CLI alternative similar to the example here in Dashboard link but with Json as input & output serialization types. I have tried running the following for Json in AWS cloud shell to get the output printed on the terminal,but end up getting…
0
votes
1 answer

Find duplicates in an array

I have a need to first test an XML file for duplicate element attributes, i.e. elements with the same attribute values. Then I need to compare those same attributes to another array. Given XML of
Gordon
  • 6,257
  • 6
  • 36
  • 89
0
votes
0 answers

More performant alternative to select-object in Powershell

I read a big Json into powershell and afterwards reduce the fields via select-object -Property $myProperties Its running fine, but its slow. Are there more performant alterantives out there? I read a little bit about linq, but I am not sure if this…
Farbkreis
  • 604
  • 3
  • 12
0
votes
1 answer

Powershell Import-CSV - How to Select-Object & Rename Specific Columns and Export to NewCSV

I am trying to simply rename the column names from an existing CSV and then export the new one. I do not want all columns. Only specific. All examples I have seen show how to do all, instead of specific columns. But I am stuck on this…
0
votes
2 answers

'get-ciminstance win32_userprofile -CimSession | select' WITHIN DO & SWITCH statements doesn't work

Cmdlet below works normally, but does nothing within a do & switch statement in code block at bottom? Debugging in ISE doesn't provide any help. Removing | Select-Object does make it function, but produces too much info. Removing -CimSession…
gregg
  • 1,084
  • 1
  • 12
  • 25