Pages

12/18/2014

Powershell Report HP Virtual Connect VLANs

Create a report from HP virtual connect for all VLAN's defined in each server profile.

$cmd = 'C:\Program Files\HP\Virtual Connect Enterprise Manager\Virtual Connect Enterprise Manager CLI\vcemcli.exe'
 $arg1 = '-export'
 $arg2= 'profiles'
 $arg3 = '-exportfile'
 $arg4 = 'profiles.csv'
 &$CMD $arg1 $arg2 $arg3 $arg4
 $raw = ".\profiles.csv" | import-csv -header ''
 $list = $raw | format-list -property "Profile Name", "*Network Name" | out-string 
 $list = $list.split("`n")
 foreach ($item in $list) { 
  $item = $item.replace("`n","")
  $descr = $item.split(":")[0]
  $value = $item.split(":")[1]
  if ( $descr -like "Profile Name*") { 
   write-output "-----------------------------"
   write-output $value
   }
  else { 
   if ( $value -notlike "*N/A*") {
    write-output "    $value"
    }
   }
  }

12/11/2014

Linux - persistent sessions

sometimes it takes a long while for a task to run. It is possible to open a screen in Linux and let it continue to run after you close out your session to the machine. Then you can logon again later, switch to the screen and check the progress.

create/open a new screen:
    screen

Leave a screen open:
    CTRL+A, CTRL+D

list open screens:
    screen -ls

switch to a screen:
    screen -r 

close the screen:
    exit