I have come across a strange issue with trying to rename items in an object (hope I am referring to this correctly). I am working with a custom ePO module (McAfee ePolicy Orchestrator) and was trying to change the name of a query result.
import-module "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ePOwerShell\ePOwerShell.psd1"
Connect-epoServer -Server Chapdappepo01 -port 8181 -Credential $cred -ignoreSSL
$test = Invoke-epoQuery -ID 117 | Where{$_.State -ne 0}
#$test | Select-object @{expression={$_.Nodename};label='system'},lastupdate,Version,Username,NewDetection,@{expression={$_.EPOBranchNode.NodeName};label='bLAH'} | Export-Csv .\test12345.csv -NoTypeInformation
#$test | Select-object @{expression={$_.Nodename};label='system'},lastupdate,Version,Username,NewDetection,@{expression={$_.EPOBranchNode.NodeName};Name="bLAH"} | Export-Csv .\test12345.csv -NoTypeInformation
$test | Select-object @{expression={$_.Nodename};label='system'},lastupdate,Version,Username,NewDetection,EPOBranchNode.NodeName | Export-Csv .\test12345.csv -NoTypeInformation
The first change works. I am successfully able to get NodeName to System
system : 764PK292T5
LastUpdate : 6/3/2015 3:29:14 PM
Version : 7.0.2.396
UserName : paden
NewDetection : False
EPOBranchNode.NodeName : Lenovo - ThinkPads
But, when i try to rename the EPOBranceNode.NodeName I get nothing:
system : 764PK292T5
LastUpdate : 6/3/2015 3:29:14 PM
Version : 7.0.2.396
UserName : paden
NewDetection : False
bLAH :
The other strange thing is if I just do $test.EPOBranceNode.NodeName I get nothing while $test.Username gives me all the usernames found.
even doing this doesn't return anything:
$TEST | % {$_.EPOBranchNode.NodeName}
while $TEST | % {$_.username} does
What am I missing?