SHARE
TWEET

Untitled

a guest Apr 21st, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  class XLSXInsert {
  2.         [Array]$InfoInserts
  3.         [Array]$vCPUInserts
  4.         [Array]$MemInserts
  5.         [Array]$DiskInserts
  6.         [Array]$PartitionInserts
  7.         [Array]$NetworkInserts
  8.         [Array]$SnapShotInserts
  9.         [Array]$VMWareToolsInserts
  10.         [Array]$ClusterInserts
  11.         [Array]$ResourcePoolInserts
  12.         [Array]$HostInserts
  13.         [Array]$HBAInserts
  14.         [Array]$NICInserts
  15.         [Array]$DataStoreInserts
  16.    
  17.     # Constructor (Client Only)
  18.    
  19.     XLSXInsert () {
  20.         [Array]$this.InfoInserts = @()
  21.     }
  22.    
  23.     # Method: Create General Information Inserts
  24.     [void] createInfoInserts () {
  25.         Try{
  26.             $DeleteStatement = "Delete from [dbo].[VMGeneralInfo] where name = 'SOMETHING_SOMETHING';`r`n"    
  27.             $InsertHeader = "INSERT INTO [dbo].[VMGeneralInfo] VALUES`r`n"
  28.             $GenericInsert = "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}');"
  29.             $GenericInsert = $GenericInsert -replace "''","NULL"
  30.             $CompleteInsert = $DeleteStatement + $InsertHeader + $GenericInsert
  31.             $this.InfoInserts += @($CompleteInsert)
  32.         }
  33.         Catch [System.Exception] {
  34.             Write-Error $_.Exception.Message
  35.         }
  36.        
  37.     }
  38. }
  39.  
  40. $inserts = [XLSXInsert]::new();
  41. $inserts.createInfoInserts();
  42. $inserts.InfoInserts
RAW Paste Data
Top