How to get an element from an output in windows powersheell - powershell

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

Related

Filter pokeApi on pokemon name

I have a question about the PokeApi that you can find here : https://pokeapi.co/
I just wanted to know if this possible to filter the api by the name of the pokemons starting with a certain letter.
Like for example get the 20 first pokemons that start with the letter "p".
I searched online but can't find any project that use filters like that so that's why Im asking there.
Thank you in advance.

PowerShell/PowerCLI how to display object properties

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

Position of Range-Object in Excel

I am trying to figure out how to get the position of a selected Range in an Excel(2007)-Worksheet. Is there something similar to $self->{EXCEL}->ActiveCell->Row for Cells (self->{EXCEL} being an Excel-Object)?
I tried ->Selection->Range, ->ActiveSheet->Range, and as a workaround ->Range->Row, ->Range->Rows both with an Excel- and a Worksheet-Object with no success.
The most fancy output being two Cell-Objects, one for the start-address, the other one end-address.
Thanks for any helpful hints!
=== Update ===
I now use successfully the command $self->{EXCEL}->Selection->Address(); to retrieve the address of the selected range. By default I get the address in "A1"-format ($E$1:$G$14). Using ->Address("ToReferenceStyle:=xlR1C1") however does not return the address in "R1C1"-format as I would have expected...
Faulty command? Ignorant Excel? Thanky again on any helpful hint!
How about ->Selection->Address? I'm not sure on the format, but the address property of the selection (range object) will give you the address of the range for example. $A$1:$B$7. You would be able to parse the start and end by splitting the string on the colon.
To address your new questions... I'm not even sure if what you're using, but the third parameter of the address method is ReferenceStyle not ToReferenceStyle. So I would try either ->Address(ReferenceStyle:=xlR1C1) or ->Address(,,xlR1C1)

QuickBase Perl API: Not able to edit a Record

I am trying to update a Quickbase record via my Perl script. I am following the Perl API documentation: http://metacpan.org/pod/HTTP::QuickBase
The method used for editing a record is "EditRecord". As per this method, you cannot edit built-in fields which is true.
and I know that I am not modifying built-in field but an user-created field.
e.g. I want to modify the field called "OS" to "Windows"
So per the Perl modules CPAN documentation mentioned above, I do this:
my %new_record=$qb_obj->GetRecord($database_id, $record_id);
$new_record{"OS"}="Windows";
$qb_obj->EditRecord($database_id, $record_id, %new_record);
But I get following error:
The field named "Date Created" with field id 1 cannot be modified
Which basically means that I ma trying to modify the field "Date Created" with Field ID "1". However, I am not doing that. It might be pulling that parameter some how. THe perl as well as the Quickbase documentation is not helping much.
Here is the Quickbase API documentation: http://www.quickbase.com/api-guide/edit_record.html#Overview
Can someone help me on this.
thanks.
Since you already know the id of the record, you don't need to read the record before modifying it. You should be able to just remove your first line, create the %new_record without reading it from QB, then your 2nd and 3rd lines should work fine.
The alternative is to remove the built-in QB fields from %new_record before doing the EditRecord.

Foursquare API nearByVenue service issue

Using Foursquare api "Venue" service.. i am parsing nearByVenue details like shop, restaurant etc.
Suppose as an example i am getting following link:
https://api.foursquare.com/v1/venues.json?geolat=40.562362&geolong=-111.938689
Issue is I am getting only 10 nearbyDetails.. suppose I am standing in New York there should be number of venue details.. why I am getting only 10 details only ?
Is there any other service or i am following wrong approach to use it?
Thanks
Add l=n where n is your limit in query string. The default limit is set to 30.
https://api.foursquare.com/v1/venues.json?geolat=40.562362&geolong=-111.938689&l=10
https://api.foursquare.com/v1/venues.xml?geolat=40.562362&geolong=-111.938689&l=50&q=coffee
You can change the value of l="no of result" parameter.
And also if you want to search for particular keyword like ATM, Coffee
then you can add the parameter q and add it's value like q="atm", q="coffee", etc.
hope it will be helpful to you.