Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Clearing WhiteSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Sangha committed Dec 4, 2016
1 parent 385d3ba commit c8d2625
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions DFW2Excel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function startExcel(){
sec_tags_ws($ws6)
$usedRange = $ws6.UsedRange
$usedRange.EntireColumn.Autofit()

Write-Host "`nRetrieving VMs in DFW Exclusion List" -foregroundcolor "magenta"
$ws7 = $wb.Worksheets.Add()
$ws7.Name = "DFW Exclusion list"
Expand Down Expand Up @@ -238,7 +238,7 @@ function l3_rules($sheet){
$sheet.Cells.Item($srcRow,6) = "NEGATE"
$sheet.Cells.Item($row,6).Font.ColorIndex = 3
}

foreach($source in $rule.sources.source){
$sheet.Cells.Item($srcRow,7) = $source.type

Expand All @@ -262,13 +262,13 @@ function l3_rules($sheet){
$sheet.Cells.Item($dstRow,13) = "ANY"
$sheet.Cells.Item($dstRow,13).Font.ColorIndex = 45
} else {

#If Negated field exists, document
if ($rule.destinations.excluded -eq "True" ){
$sheet.Cells.Item($srcRow,10) = "NEGATE"
$sheet.Cells.Item($row,10).Font.ColorIndex = 3
}

foreach($destination in $rule.destinations.destination){
$sheet.Cells.Item($dstRow,11) = $destination.type
if($destination.type -eq "Ipv4Address"){
Expand Down Expand Up @@ -358,9 +358,9 @@ function pop_sg_ws($sheet){
$sheet.Cells.Item($row,2) = $member.scope.name
$sheet.Cells.Item($row,3) = $member.isUniversal
$sheet.Cells.Item($row,4) = $member.inhertianceAllowed

$sheet.Cells.Item($row,5) = "Dynamic"

foreach ($entity in $member.dynamicMemberDefinition.dynamicSet.dynamicCriteria){
$sheet.Cells.Item($row,6) = $entity.key
$sheet.Cells.Item($row,7) = $entity.operator
Expand All @@ -374,12 +374,12 @@ function pop_sg_ws($sheet){
$sheet.Cells.Item($row,2) = $member.scope.name
$sheet.Cells.Item($row,3) = $member.isUniversal
$sheet.Cells.Item($row,4) = $member.inhertianceAllowed

$sheet.Cells.Item($row,5) = "Static"
$row++
}
}

$sheet.Cells.Item($row,1) = "Security Group Membership"
$sheet.Cells.Item($row,1).Font.Size = $titleFontSize
$sheet.Cells.Item($row,1).Font.Bold = $titleFontBold
Expand All @@ -390,15 +390,15 @@ function pop_sg_ws($sheet){
$range2.merge() | Out-Null

$row++

$sheet.Cells.Item($row,1) = "SG Name"
$sheet.Cells.Item($row,2) = "VM ID"
$sheet.Cells.Item($row,3) = "VM Name"
$range3 = $sheet.Range("a"+$row, "c"+$row)
$range3.Font.Bold = $subTitleFontBold
$range3.Interior.ColorIndex = $subTitleInteriorColor
$range3.Font.Name = $subTitleFontName

$row++

foreach ($member in $sg){
Expand Down Expand Up @@ -632,22 +632,22 @@ function pop_sec_tags_ws($sheet){
$sheet.Cells.Item($row,4) = $tag.systemResource
$row++ # Increment Rows
}

$sheet.Cells.Item($row,1) = "Security Tag Name"
$sheet.Cells.Item($row,2) = "VM Name"
$range3 = $sheet.Range("a"+$row, "b"+$row)
$range3.Font.Bold = $subTitleFontBold
$range3.Interior.ColorIndex = $subTitleInteriorColor
$range3.Font.Name = $subTitleFontName

$row ++

# Retrieve a list of all Tag Assignments
$tag_assign = $ST | Get-NsxSecurityTagAssignment

# Traverse VM membership and populate spreadsheet
foreach ($mem in $tag_assign){

$sheet.Cells.Item($row,1) = $mem.SecurityTag.name
$sheet.Cells.Item($row,2) = $mem.VirtualMachine.name
$row++
Expand Down

0 comments on commit c8d2625

Please sign in to comment.