Git Product home page Git Product logo

infoblox's Introduction

Build status

Infoblox PowerShell Module

This is a PowerShell module for working with the Infoblox Web API.

This is a quick and dirty implementation based on my environment's configuration, with limited functionality. Contributions to improve this would be more than welcome!

Some caveats:

  • A number of shortcuts have been taken given that this is a fast publish. This is more of a demo module; I have no plans to address these, but contributions are welcome!
    • Limited testing, limited validation of edge case scenarios
    • Limited error handling
    • Limited comment based help and examples (some may be outdated)

#Functionality

Search Infoblox DHCP leases:

  • Search for Infoblox DHCP leases

Search for Infoblox networks

  • Search for Infoblox networks

Search for Infoblox for IPAM IPv4 addresses between two IPs

  • Search for Infoblox DHCP leases

#Prerequisites

  • You must be using Windows PowerShell 3 or later on the system running this module
  • You must have your Infoblox configured to allow access to the Web API
  • You must have access to query the Infoblox Web API
  • We serialize a default Uri Infoblox.xml in the module path - you must have access to that path for this functionality
  • Module folder downloaded, unblocked, extracted, available to import

#Instructions

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the Infoblox folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)

# Import the module.
    Import-Module Infoblox    #Alternatively, Import-Module \\Path\To\Infoblox

# Get commands in the module
    Get-Command -Module Infoblox

# Get help for a command or two
    Get-Help Set-IBConfig -Full
    Get-Help New-IBSession -Full

# Optional persistent default config setup
# This configures Infoblox.xml in your module folder, will load each time you import the module
    Set-IBConfig -Uri "https://grid.contoso.com" -IBVersion "v1.6"

# View the current config settings
    Get-IBConfig

# Establish a new session.  This uses the IBConfig Uri and IBVersion
    New-IBSession -Credential (Get-Credential)

    # Note! if you don't have certificates set up correctly, you may see the following error.  Set-TrustAllCertsPolicy is a temporary solution
    # Error retrieving session: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    # Set-TrustAllCertsPolicy

# Get all leases 
    Get-IBLease

# Get leases for any address in 192.168.0., with a free binding state
    Get-IBLease -Address 192.168.0. | Where {$_.binding_state -like "FREE"}

# Get a list of all networks defined on the InfoBlox.  Get-IBObject is a generic wrapper to pull random object types
    Get-IBObject -Object Network

# Maybe you want to go from an IP address to a network:

    # Get network from IPAM for a single IP
        $filter = [pscustomobject]@{
                    Object="ip_address"
                    Operator="="
                    Filter="192.168.0.54"
                }

        $Network = Get-IBObject -Filters $filter -Object IPV4Address | Select -ExpandProperty network


    # Get the corresponding network object
        $filter = [pscustomobject]@{
                    Object="network"
                    Operator="="
                    Filter=$Network
                }

        Get-IBObject -Filters $filter -Object Network 

# Find all IPAM IPv4 Addresses between two IPs
    $filters = [pscustomobject]@{
        Object="ip_address"
        Operator=">="
        Filter="192.168.0.10"
    },
    [pscustomobject]@{
        Object="ip_address"
        Operator="<="
        Filter="19.168.0.100"
    }

    Get-IBObject -Filters $filters -Object IPV4Address

#NOTES

Publishing this as a reference to this blog post. Infoblox' Web API highlights the need for vendors to provide PowerShell modules layered on top of their APIs, rather than offloading this to their customers.

  • The API documentation this used was 962 pages (most of which you can skip, thankfully)
  • Unique syntax and formatting that you must read up on and implement, including features like paging and filters
  • I'm not too familiar with the Infoblox. I'm a consumer of a few services, and happen to like using PowerShell. Someone more familiar with the technology (the vendor) should be writing a PowerShell module.
  • I'm only going to spend as much time as needed to get a result that meets my needs for reliability, functionality, and configuration.
  • I have other priorities. Reading through pages upon pages of documentation that only applies to a single product's API is inefficient. This is one of the benefits of PowerShell; I learn a bit about the language, and it applies to the AD, VMware, SQL, and other PowerShell-enabled technologies.

Thanks to Don Smith and Anders Wahlqvist for ideas (and likely code snippets, this was written a long time ago)

Project Status, 1/17/2016: I no longer work with or have access to an Infoblox. Feel free to fork this or use it as needed, but there will likely be no further development, barring external contributions.

infoblox's People

Contributors

ramblingcookiemonster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infoblox's Issues

[Question] Reuse some of your code parts

Hi @RamblingCookieMonster I had a look at your module and saw that you are publishing this under MIT license. As we also have a basic PoSH module for Infoblox REST integration I wanted to formally ask if we could re-use some of your code. The reason for re-using/re-formatting (instead of just plain using yours) is that we have some kind of different basic architecture/approach (logging, error handling) and therefore would prefer to port some of your Cmdlets to our module.
Thanks in advance for your reply! Regards, Ronald

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.