Skip to main content

All Questions

0 votes
0 answers
16 views

powershell array of object with dynamic properties outputs only properties from first element [duplicate]

why ? and how to fix this ? how to export to csv file now after export i receive the same as when displaying $res. $res= @() $obj = [PSCustomObject]@{} $obj | Add-Member -MemberType NoteProperty -Name ...
Tomasz Szczypiński's user avatar
0 votes
1 answer
43 views

How to Include All Properties in GridView Even if They're Absent in Some Objects?

I'm using PowerShell to parse XML content and display the results in a grid view. Here's the code I'm using: $content = @" <root> <obj> <name>John</name> ...
Fajela Tajkiya's user avatar
0 votes
1 answer
183 views

Adding a property that is hidden unless it has a value

I'm adding a class related to software packages. Here is a barebones version for the purposes of this question: class Package { $Name; $Latest; $Prerelease [string]ToString(){ return $this....
Maybe's user avatar
  • 843
0 votes
0 answers
67 views

Creating Events in Powershell

The Task: I'm writing a script that makes changes to an AD Object (user account) in sequential order: Name change Group add Demographics change Manager name added Add email address The problem: I ...
Liquyd's user avatar
  • 1
0 votes
1 answer
62 views

Text file to Text file String Conversion Using Powershell CSV Objects

I can change the column order of text in a file: 001 AALTON Alan 25 Every Street 002 BROWN James 101 Browns Road 003 CAMPBELL Colin 57 Camp Avenue to have the first names listed before surnames ...
Dave's user avatar
  • 833
0 votes
1 answer
361 views

How to Extract string from XML Property

Using PowerShell, I am attempting to extract the contents of Value="" which will either be Production or Training, from a XML file. Here is a snippit of the XML file: <ParameterGroup ...
Spagooch's user avatar
1 vote
1 answer
2k views

Get AD Group Member Groups and Find Those Group Notes in One Query

I would like to find an AD group user's group's that their in and to find what those different group's notes are. Right now, I'm trying this Get-ADPrincipalGroupMembership "username" | Get-...
Michael's user avatar
  • 103
0 votes
1 answer
149 views

How to add another property to the element of array based on mapping

In Powershell I have the following array foreach ($Record in $Records) { write-host $Record } @{car=OPEL; count=3} @{car=BMW; count=2} @{car=OPEL; count=8} @{car=AUDI; count=3} @{car=FORD; count=5} @{...
Georgi Gochev's user avatar
0 votes
1 answer
453 views

Possible to sort object by property (descending) and still display corresponding values?

$procs = Get-Process $procs[0] | GM -MemberType Property This gives all the properties in ascending order. Now, I'd like to display the properties in descending order but with it's values. It's easy ...
colonel_claypoo's user avatar
1 vote
1 answer
1k views

PowerShell object properties recursive

I need a function with the following requirements: The function is assigned an unknown object. It is not known how many properties and / or sub-objects the object has. The function then iterates ...
Alex's user avatar
  • 135
0 votes
1 answer
204 views

powershell compare properties of two network adapters side-by-side

I'm just beginning Powershell, and I want to look at all the properties of two network adapters side-by-side in order to easily see differences. I've used: Get-NetAdapter -name "(adapter's name)" | ...
wrosen01's user avatar
  • 127
1 vote
0 answers
3k views

How do you compare two arrays that both have multiple properties and objects in Powershell

I am looking for a way to go through each array in a collection. So I have two csvs that I have imported and I need to compare the data on each. Sample Array contents From CSV1 (Array is $Collection1)...
alsoszaa's user avatar
1 vote
1 answer
3k views

Strongly type PS custom object properties

I have been using hash tables to return complex data from functions, and it has worked well, but I would like to have the keys strongly typed, since I have booleans, strings, arrays of strings, ...
Gordon's user avatar
  • 6,693
2 votes
2 answers
9k views

How to search an object for a value?

Let's say you have a giant object - one which may or may not have nested arrays / objects, # Assuming 'user1' exists in the current domain $obj = Get-ADUser 'user1' -Properties * and I want to ...
Kellen Stuart's user avatar
0 votes
1 answer
2k views

How to check if an object member exists in array by property?

Can't get my head around how to check if an object member exists in array by property. I have the following object: PS> $siteUser Id Title LoginName ...
colonel_claypoo's user avatar

15 30 50 per page