Last active
April 10, 2019 07:15
-
-
Save sdaaish/09dc0155c140e88acd4d13bd998f9ed1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System | Ip | Type | Other | |
---|---|---|---|---|
dev.idg.se | 1.1.1.1 | Ubuntu | Development | |
hr.dn.se | 2.2.2.2 | Debian | Human Resources | |
www.gp.se | 3.3.3.3 | FreeBsd | Front web site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cmdletbinding()] | |
Param ( | |
[Parameter(Mandatory)] | |
$Path | |
) | |
$csv = import-csv $Path | |
$csv|Add-Member -NotePropertyName ShortHost -NotePropertyValue '' | |
$collection = @() | |
foreach($i in $csv){ | |
$i.shorthost = ($i.system).split(".")[0] | |
$collection += $i | |
} | |
$collection|select-object System,ShortHost,Ip,Type,Other | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment