If you are using PowerShell and in the console or the scripts you need to have your public IP address then Ripe NCC can really help you get this.
You can query RIPE stat servers and receive your IP address as JSON and save it in a variable to use it later.
To get the JSON data just excecute this:
C:\Windows\system32> $a = (Invoke-WebRequest -Uri "https://stat.ripe.net/data/whats-my-ip/data.json" | ConvertFrom-Json)
and you should have this output:
PS C:\Windows\system32> $a
status : ok
server_id : stat-app15
status_code : 200
version : 0.1
cached : False
see_also : {}
time : 2017-06-18T21:49:27.221689
messages : {}
data_call_status : supported
process_time : 24
build_version : 2017.6.15.213
query_id : 000c524e-5470-11e7-8856-00505688b546
data : @{ip=123.123.123.123}
If you just need the IP address then filter out only the IP address object like this:
$ip_address = (Invoke-WebRequest -Uri "https://stat.ripe.net/data/whats-my-ip/data.json" | ConvertFrom-Json).data.ip
output:
PS C:\Windows\system32> $ip_address
123.123.123.123
Subscribe to:
Post Comments (Atom)
Creating a new LDAP server with FreeIPA and configure to allow vSphere authentication
Was setting up a new FreeIPA sever for my homelab and found out that the default configuration in FreeIPA does not allow you to use VMware v...
-
Was setting up a new FreeIPA sever for my homelab and found out that the default configuration in FreeIPA does not allow you to use VMware v...
-
Managing Foreman recently and got bored to configure it each time I set it up from scratch. This blog post will cover initial foreman instal...
-
From: ENISA. This guide wants to assist SMEs understand the security risks and opportunities they should take into account when procuring ...
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.