I am using PowerNSX module to work with NSX and I would like to retrieve ESG syslog server configuration.
I have managed to find out how to get values using $esgs = get-nsxedge and then retrieve values by typing $esgs.features.syslog.serveraddresses
I've got an output of several IP's. I would like to display ESG name (it is retrieved from get-nsxedge) and combine it with retrieved syslog IP.
How can I achieve this?
Br
wojcieh
Based on above description I guess that the information you want to combine is stored in $esgs. To select the name and the IP addresses you've to use calculated properties.
Example:
$esgs | select-object -Property PropertyNameWhereEsgNameIsStored, #{Name="IpAddresses";Expression={$_.features.syslog.serveraddresses}}
Hope that helps
Related
I am trying to find the best way to use the notes field to set a shutdown order of virtual machines. At the moment, I have a note in my VM's as "Startup: X" where X is the number I want to use for startup, but the reverse being what I want for shutdown. The goal is to put this into a workflow so that machines complete their startup/shutdown before the next machine comes up.
Currently, I can get the info from the VMs by doing:
Get-VM | Where-Object {$_.Notes -contains "Startup:"} | Select-Object name,notes
It's my understanding that I want to put this into an object, then loop through that object based on the value after the ":" (e.g. 1, 2, 3, 4, 5, etc.) in either ascending or descending order. However, I'm not sure if that's the best method to work on this or not. All I know is that I want to look for the Startup: line in the VM Notes field, then use that alone to determine order. Some VMs might have other notes in them that I want to ignore, so I only want the Startup: string to show.
Could anyone give me some assistance? Or, let me know if I'm on the wrong path?
I have tried using multiple methods to parse, but I keep getting null errors that I cannot figure out. I'm fairly new to using PS in this way, so that doesn't help.
I have an output like:
PS C:\Users\parul> $test2
id label region type image status ipv4
21648848 ubuntu-us-west us-west g6-standard-1 linode/ubuntu20.04 offline 173.255.216.222
I need to get the id value only. How to i get this in powershell
Please refine your question. If you are really asking for how to use properties a google search would've done the trick in under 1 minute.. To answer your question:
help about_Variables
$test2.id
So I need to create a report of what odbc-dsns are on computers.
The first hurdle I'm trying to do is get the csv to output correctly on MINE. Then I figure I'll just deploy a runonce group policy with the script set to append.
The problem is that get-odbcdns returns an object. That object has:
Name: the friendly name of the odbc
Attribute : {Description}
I just want to be able to formatlist with the VALUE of the {Description} value inside the Attribute property. I can't figure out how to do that.
Whenever I go | fl name, attribute
it returns 1sl-den-db01 and {description} I would like for it to actually parse out description from Attribute. No idea how. Thoughts?
trying to see if anyone succeeded in pulling this from powershell... There is a constructed attribute for a read only domain controller , which contains details about the cached accounts in it, msds-revealedusers .see command below ...................................................... Get-ADComputer Readonlydomaincontrollername -Server NAMEOFDOMAIN -Properties msds-revealedusers | select -ExpandProperty msds-revealedusers.
its a binary data, but trying to convert it into readable value as you see in the GUI in ADUC for the Read only domain controller ...
B:96:A00009001B0000004DCAD20F03000000F6781F56E3FEDD48818E932B355D4113CF836322000000009F4FAC1C00000000:CN=USERNAMEOU=OU1,OU=DC,OU=WHATEVER,OU=WHENEVER,DC=DC,DC=DOMAIN,DC=com
above is the data you get out with powershell , but the actual values via gui should be something with the lmpwdhistory,ntpwdhistory etc
Is there a way of getting instance's description (eg, instance ID, AMI ID, VPC ID....etc) and tags using Powershell?
I tried Get-EC2Instance | select * but it doesn't give all the information I need.
Good starting point would be to store your instances in a variable.
$ec2 = Get-EC2Instance
$ec2.instances
will display all the info you can get.
Same can be done like this
(Get-EC2Instance).Instances
or filter only what you need.
(Get-EC2Instance).Instances | select-object ImageId,InstanceId,VpcId