├── ADinfo.ps1 ├── BuildNimbleDatastore.ps1 ├── FormMove-CrossVC.ps1 ├── LICENSE ├── Move-CrossVC.ps1 ├── NUMAReport.ps1 ├── NUMAReportcsv.ps1 ├── OVNimbleDataStoreBuild.ps1 ├── OVNimbleDatastore.ps1 ├── OVVolumeBuild.ps1 ├── PSVMReport.ps1 ├── PatchCompliance.ps1 ├── README.md ├── VMReport.ps1 ├── VMinfo.ps1 ├── add-stdportgroup.ps1 ├── alarms.ps1 ├── export.ps1 ├── get-LUNinfo.ps1 ├── import.ps1 ├── set-multipath.ps1 └── show-menu.ps1 /ADinfo.ps1: -------------------------------------------------------------------------------- 1 | $Computers = (Get-ADComputer -Filter *).count 2 | $Workstations = (Get-ADComputer -LDAPFilter "(&(objectClass=Computer)(!operatingSystem=*server*))" -Searchbase (Get-ADDomain).distinguishedName).count 3 | $Servers = (Get-ADComputer -LDAPFilter "(&(objectClass=Computer)(operatingSystem=*server*))" -Searchbase (Get-ADDomain).distinguishedName).count 4 | $Users = (get-aduser -filter *).count 5 | $domain = Get-ADDomain |FT Forest 6 | $FSMO = netdom query FSMO 7 | $ADForest = (Get-ADForest).ForestMode 8 | $ADDomain = (Get-ADDomain).DomainMode 9 | $ADVer = Get-ADObject (Get-ADRootDSE).schemaNamingContext -property objectVersion | Select objectVersion 10 | $ADNUM = $ADVer -replace "@{objectVersion=","" -replace "}","" 11 | 12 | If ($ADNum -eq '88') {$srv = 'Windows Server 2019'} 13 | ElseIf ($ADNum -eq '87') {$srv = 'Windows Server 2016'} 14 | ElseIf ($ADNum -eq '69') {$srv = 'Windows Server 2012 R2'} 15 | ElseIf ($ADNum -eq '56') {$srv = 'Windows Server 2012'} 16 | ElseIf ($ADNum -eq '47') {$srv = 'Windows Server 2008 R2'} 17 | ElseIf ($ADNum -eq '44') {$srv = 'Windows Server 2008'} 18 | ElseIf ($ADNum -eq '31') {$srv = 'Windows Server 2003 R2'} 19 | ElseIf ($ADNum -eq '30') {$srv = 'Windows Server 2003'} 20 | 21 | 22 | 23 | Write-Host "For this Domain there are;" 24 | Write-Host "Computers = "$Computers -ForegroundColor Cyan 25 | Write-Host "Workstions = "$Workstations -ForegroundColor Cyan 26 | Write-Host "Servers = "$Servers -ForegroundColor Cyan 27 | Write-Host "Users = "$Users -ForegroundColor Cyan 28 | Write-host "" 29 | Write-host "Active Directory Info" -ForegroundColor Yellow 30 | Write-Host "Active Directory Forest Mode = "$ADForest -ForegroundColor Cyan 31 | Write-Host "Active Directory Domain Mode = "$ADDomain -ForegroundColor Cyan 32 | Write-Host "Active Directory Schema Version is $ADNum which corresponds to $Srv" -ForegroundColor Cyan 33 | Write-Host "" 34 | Write-Host "FSMO Role Owners" -ForegroundColor Cyan 35 | $FSMO 36 | 37 | Write-Host "Active Directory Health Check" -ForegroundColor Yellow 38 | Write-Host "" 39 | #####################################Get ALL DC Servers################################# 40 | $getForest = [system.directoryservices.activedirectory.Forest]::GetCurrentForest() 41 | 42 | $DCServers = $getForest.domains | ForEach-Object {$_.DomainControllers} | ForEach-Object {$_.Name} 43 | 44 | $timeout = "60" 45 | foreach ($DC in $DCServers){ 46 | $Identity = $DC 47 | ################Ping Test###### 48 | if ( Test-Connection -ComputerName $DC -Count 1 -ErrorAction SilentlyContinue ) { 49 | Write-Host $DC `t $DC `t Ping Success -ForegroundColor Green 50 | ##############Netlogon Service Status################ 51 | $serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "Netlogon" -ErrorAction SilentlyContinue} -ArgumentList $DC 52 | wait-job $serviceStatus -timeout $timeout 53 | if($serviceStatus.state -like "Running") 54 | { 55 | Write-Host $DC `t Netlogon Service TimeOut -ForegroundColor Yellow 56 | stop-job $serviceStatus 57 | } 58 | else 59 | { 60 | $serviceStatus1 = Receive-job $serviceStatus 61 | if ($serviceStatus1.status -eq "Running") { 62 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green 63 | $svcName = $serviceStatus1.name 64 | $svcState = $serviceStatus1.status 65 | } 66 | else 67 | { 68 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red 69 | $svcName = $serviceStatus1.name 70 | $svcState = $serviceStatus1.status 71 | } 72 | } 73 | } 74 | ##############NTDS Service Status################ 75 | $serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "NTDS" -ErrorAction SilentlyContinue} -ArgumentList $DC 76 | wait-job $serviceStatus -timeout $timeout 77 | if($serviceStatus.state -like "Running") 78 | { 79 | Write-Host $DC `t NTDS Service TimeOut -ForegroundColor Yellow 80 | stop-job $serviceStatus 81 | } 82 | else 83 | { 84 | $serviceStatus1 = Receive-job $serviceStatus 85 | if ($serviceStatus1.status -eq "Running") { 86 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green 87 | $svcName = $serviceStatus1.name 88 | $svcState = $serviceStatus1.status 89 | } 90 | else 91 | { 92 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red 93 | $svcName = $serviceStatus1.name 94 | $svcState = $serviceStatus1.status 95 | } 96 | } 97 | ##############DNS Service Status################ 98 | $serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "DNS" -ErrorAction SilentlyContinue} -ArgumentList $DC 99 | wait-job $serviceStatus -timeout $timeout 100 | if($serviceStatus.state -like "Running") 101 | { 102 | Write-Host $DC `t DNS Server Service TimeOut -ForegroundColor Yellow 103 | stop-job $serviceStatus 104 | } 105 | else 106 | { 107 | $serviceStatus1 = Receive-job $serviceStatus 108 | if ($serviceStatus1.status -eq "Running") { 109 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green 110 | $svcName = $serviceStatus1.name 111 | $svcState = $serviceStatus1.status 112 | } 113 | else 114 | { 115 | Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red 116 | $svcName = $serviceStatus1.name 117 | $svcState = $serviceStatus1.status 118 | } 119 | } 120 | ####################Netlogons status################## 121 | add-type -AssemblyName microsoft.visualbasic 122 | $cmp = "microsoft.visualbasic.strings" -as [type] 123 | $sysvol = start-job -scriptblock {dcdiag /test:netlogons /s:$($args[0])} -ArgumentList $DC 124 | wait-job $sysvol -timeout $timeout 125 | if($sysvol.state -like "Running") 126 | { 127 | Write-Host $DC `t Netlogons Test TimeOut -ForegroundColor Yellow 128 | stop-job $sysvol 129 | } 130 | else 131 | { 132 | $sysvol1 = Receive-job $sysvol 133 | if($cmp::instr($sysvol1, "passed test NetLogons")) 134 | { 135 | Write-Host $DC `t Netlogons Test passed -ForegroundColor Green 136 | } 137 | else 138 | { 139 | Write-Host $DC `t Netlogons Test Failed -ForegroundColor Red 140 | } 141 | } 142 | 143 | ####################Replications status################# 144 | add-type -AssemblyName microsoft.visualbasic 145 | $cmp = "microsoft.visualbasic.strings" -as [type] 146 | $sysvol = start-job -scriptblock {dcdiag /test:Replications /s:$($args[0])} -ArgumentList $DC 147 | wait-job $sysvol -timeout $timeout 148 | if($sysvol.state -like "Running") 149 | { 150 | Write-Host $DC `t Replications Test TimeOut -ForegroundColor Yellow 151 | stop-job $sysvol 152 | } 153 | else 154 | { 155 | $sysvol1 = Receive-job $sysvol 156 | if($cmp::instr($sysvol1, "passed test Replications")) 157 | { 158 | Write-Host $DC `t Replications Test passed -ForegroundColor Green 159 | } 160 | else 161 | { 162 | Write-Host $DC `t Replications Test Failed -ForegroundColor Red 163 | } 164 | } 165 | ####################Services status##################### 166 | add-type -AssemblyName microsoft.visualbasic 167 | $cmp = "microsoft.visualbasic.strings" -as [type] 168 | $sysvol = start-job -scriptblock {dcdiag /test:Services /s:$($args[0])} -ArgumentList $DC 169 | wait-job $sysvol -timeout $timeout 170 | if($sysvol.state -like "Running") 171 | { 172 | Write-Host $DC `t Services Test TimeOut -ForegroundColor Yellow 173 | stop-job $sysvol 174 | } 175 | else 176 | { 177 | $sysvol1 = Receive-job $sysvol 178 | if($cmp::instr($sysvol1, "passed test Services")) 179 | { 180 | Write-Host $DC `t Services Test passed -ForegroundColor Green 181 | } 182 | else 183 | { 184 | Write-Host $DC `t Services Test Failed -ForegroundColor Red 185 | } 186 | } 187 | ####################Advertising status################## 188 | add-type -AssemblyName microsoft.visualbasic 189 | $cmp = "microsoft.visualbasic.strings" -as [type] 190 | $sysvol = start-job -scriptblock {dcdiag /test:Advertising /s:$($args[0])} -ArgumentList $DC 191 | wait-job $sysvol -timeout $timeout 192 | if($sysvol.state -like "Running") 193 | { 194 | Write-Host $DC `t Advertising Test TimeOut -ForegroundColor Yellow 195 | stop-job $sysvol 196 | } 197 | else 198 | { 199 | $sysvol1 = Receive-job $sysvol 200 | if($cmp::instr($sysvol1, "passed test Advertising")) 201 | { 202 | Write-Host $DC `t Advertising Test passed -ForegroundColor Green 203 | } 204 | else 205 | { 206 | Write-Host $DC `t Advertising Test Failed -ForegroundColor Red 207 | } 208 | } 209 | ####################FSMOCheck status################## 210 | add-type -AssemblyName microsoft.visualbasic 211 | $cmp = "microsoft.visualbasic.strings" -as [type] 212 | $sysvol = start-job -scriptblock {dcdiag /test:FSMOCheck /s:$($args[0])} -ArgumentList $DC 213 | wait-job $sysvol -timeout $timeout 214 | if($sysvol.state -like "Running") 215 | { 216 | Write-Host $DC `t FSMOCheck Test TimeOut -ForegroundColor Yellow 217 | stop-job $sysvol 218 | } 219 | else 220 | { 221 | $sysvol1 = Receive-job $sysvol 222 | if($cmp::instr($sysvol1, "passed test FsmoCheck")) 223 | { 224 | Write-Host $DC `t FSMOCheck Test passed -ForegroundColor Green 225 | } 226 | else 227 | { 228 | Write-Host $DC `t FSMOCheck Test Failed -ForegroundColor Red 229 | } 230 | } 231 | Write-Host "" 232 | } 233 | -------------------------------------------------------------------------------- /BuildNimbleDatastore.ps1: -------------------------------------------------------------------------------- 1 | #connect to Nimble, be sure to add your Nimble IP or FQDN in the "" 2 | Write-Host "Connecting to Nimble" -ForegroundColor Green 3 | Connect-NSGroup "" -IgnoreServerCertificate -Credential admin 4 | 5 | #VMWare performance policy ID 6 | $id = "0366971348fab73f4b000000000000000000000014" 7 | 8 | #Initiator Groups (per host) 9 | $CMH001 = "0266971348fab73f4b000000000000000000000007" 10 | $CMH002 = "0266971348fab73f4b000000000000000000000008" 11 | $CMH003 = "0266971348fab73f4b000000000000000000000009" 12 | $CMH004 = "0266971348fab73f4b00000000000000000000000a" 13 | 14 | $name = Read-Host "Enter Datastore Name" 15 | $size = Read-Host "Enter Datastore Size in MB" 16 | 17 | New-NSVolume -name $name -size $size -perfpolicy_id $id -thinly_provisioned $true -online $true 18 | 19 | #remove charactors in the volume id so they are usable 20 | $vol = Get-NSvolume -name "test2" | select ID 21 | $id = $vol -replace "@{id=","" -replace "}", "" 22 | 23 | #add new volume to initiator groups 24 | New-NSAccessControlRecord -vol_id $id -apply_to both -initiator_group_id $CMH001 -lun 4 25 | New-NSAccessControlRecord -vol_id $id -apply_to both -initiator_group_id $CMH002 -lun 4 26 | New-NSAccessControlRecord -vol_id $id -apply_to both -initiator_group_id $CMH003 -lun 4 27 | New-NSAccessControlRecord -vol_id $id -apply_to both -initiator_group_id $CMH004 -lun 4 28 | 29 | #connect to vmware to create datastore 30 | Write-host "Connecting to vCenter" -ForegroundColor Green 31 | Connect-viserver 192.168.151.2 -User administrator@vsphere.local 32 | 33 | #rescan host for new storage 34 | Get-VMHost | Get-VMHostStorage -RescanAllHba -Refresh 35 | 36 | #function to find free LUNs found at http://vcloud-lab.com/entries/powercli/find-free-or-unassigned-storage-lun-disks-on-vmware-esxi-server 37 | # removed some of the notes to save space 38 | function Get-FreeEsxiLUNs { 39 | #EXAMPLE 40 | #Get-FreeEsxiLUNs -Esxihost Esxi001.vcloud-lab.com 41 | #Shows free unassigned storage Luns disks on Esxi host name Esxi001.vcloud-lab.com 42 | ############################### 43 | 44 | [CmdletBinding()] 45 | param( 46 | [Parameter(Position=0, Mandatory=$true)] 47 | [System.String]$Esxihost 48 | ) 49 | Begin { 50 | if (-not(Get-Module vmware.vimautomation.core)) { 51 | Import-Module vmware.vimautomation.core 52 | } 53 | #Connect-VIServer | Out-Null 54 | } 55 | Process { 56 | $VMhost = Get-VMhost $EsxiHost 57 | $AllLUNs = $VMhost | Get-ScsiLun -LunType disk 58 | $Datastores = $VMhost | Get-Datastore 59 | foreach ($lun in $AllLUNs) { 60 | $Datastore = $Datastores | Where-Object {$_.extensiondata.info.vmfs.extent.Diskname -Match $lun.CanonicalName} 61 | if ($Datastore.Name -eq $null) { 62 | $lun | Select-Object CanonicalName, CapacityGB, Vendor 63 | } 64 | } 65 | } 66 | End {} 67 | } 68 | 69 | $free = Get-FreeEsxiLUNs -Esxihost (get-vmhost | Get-random) | Where-Object {$_.Vendor -eq "Nimble"} |select CanonicalName 70 | $path = $free -replace "@{CanonicalName=","" -replace "}","" 71 | 72 | 73 | #create new Datastore 74 | Get-VMHost| Get-Random | New-Datastore -name "test" -Path $path -Vmfs -FileSystemVersion 6 75 | 76 | #rescan vhost for new Datastore 77 | Get-VMHost | Get-VMHostStorage -RescanAllHba -Refresh 78 | 79 | #Disconnect from Nimble and vCenter 80 | Disconnect-NSGroup 81 | Disconnect-VIServer -Server * -confirm:$false 82 | -------------------------------------------------------------------------------- /FormMove-CrossVC.ps1: -------------------------------------------------------------------------------- 1 | $inputXML = @" 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |