jvm2016's Posts

i dont see any space in the file .i tested one of them with get-vmhost command and it worked fine ..
not sure how it appeared .its fine if i m printing $v
Hi Luc, i am getting very weird error .following code works fine till orange however when i m trying to get vmhost to do further activities it throws error . esxi1.localhost.com get-vmho... See more...
Hi Luc, i am getting very weird error .following code works fine till orange however when i m trying to get vmhost to do further activities it throws error . esxi1.localhost.com get-vmhost : 28/10/2020 14:45:32 Get-VMHost VMHost with name 'esxi1.localhost.com ' was not found using the specified filter(s). At line:6 char:1 + get-vmhost -Name $v + ~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (:) [Get-VMHost], VimException     + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimA    utomation.ViCore.Cmdlets.Commands.GetVMHost $esxis=import-csv "C:\Users\jvmishra\Desktop\fileroot.csv" foreach($e in $esxis) { $v=$e.esxiname $v get-vmhost -Name $v }
right now i a able to find that property to get the desired output .i am working on the logic to extend the previous script. thanks for your support .
Hi Luc, Get-VMHostNetworkAdapter -VMHost $esxi -VMKernel|?{$_. while typing above i was expecting ManagementTrafficEnabled as one of the listed properties but i did not find that .not sur... See more...
Hi Luc, Get-VMHostNetworkAdapter -VMHost $esxi -VMKernel|?{$_. while typing above i was expecting ManagementTrafficEnabled as one of the listed properties but i did not find that .not sure if its a bug or someother thing but it is not the exptected response .i need to write manually ...colud you suggest something on this Get-VMHostNetworkAdapter -VMHost $esxi -VMKernel|?{$_.ManagementTrafficEnabled -eq "true"}
thanks Luc . i am going to ask other conditions in next post referring to this script only .i need to to add more to it to get proper compliance report . thanks again ..
i want to add some other conditions in this report .for the time being i added following if password length of root is not 16 characters(orange code ) it should print in the report . can... See more...
i want to add some other conditions in this report .for the time being i added following if password length of root is not 16 characters(orange code ) it should print in the report . can you please check if that has been added correctly to report $path1 = 'D:\compliance' $path = "D:\compliance\compliance_test-$(Get-Date -Format 'yyyyMMdd-HHmm').html" #$path = "D:\Temp\compliance-$(Get-Date -Format 'yyyyMMdd-HHmm').html" (get-credential).password | ConvertFrom-SecureString | set-content "$path1\password.txt" $password = Get-Content "$path1\password.txt" | ConvertTo-SecureString $credential = New-Object System.Management.Automation.PsCredential("administrator@vsphere.local",$password) connect-viserver -server "ukpnnhvcsa001.ibm-infra.local" -Credential $credential $head = @' <style> body { background-color:#dddddd;        font-family:Tahoma;        font-size:12pt; } td, th { border:1px solid black;          border-collapse:collapse; } th { color:white;      background-color:violet; } table, tr, td, th { padding: 2px; margin: 0px } table { margin-left:50px; } </style> '@ $deviated_esxi=@() foreach($e in Get-VMHost) {     $accountunlocktime_minutes=(Get-AdvancedSetting -Entity $e -Name Security.AccountUnlockTime).value/60     if($accountunlocktime_minutes -ne "60"){         $deviated_esxi += [PSCustomObject]@{             esxiname = $e.Name             accountunlocktime_minutes=$accountunlocktime_minutes         }     } } $frag = $deviated_esxi|     ConvertTo-Html -Property esxiname -Fragment -PreContent '<h2>esxiwithlockdowntime not60mins </h2>' |     Out-String $esxi_pasword_length=read-host "please provide password for one of the esxi" if($esxi_pasword_length.Length -ne "16") { write-host "password length is not as per agreed value " $esxi_pasword_length.Length|     ConvertTo-Html -PreContent '<h2>paswordlength </h2>' |     Out-String } ConvertTo-HTML -head $head -PostContent $frag | Out-String | Out-File -FilePath $path
yes
very strange now i m getting this .if yu can suggest whats is wrong with my code .
its still giving info in single row . i want one column with header esxi name and below that names of esxi esxinames esxi1 esxi2 esxi3
Hi luc , can yu please check html command to get proper output . $path1 = 'D:\hc' $path = "D:\hc\compliance-$(Get-Date -Format 'yyyyMMdd-HHmm').html" #(get-credential).password | Co... See more...
Hi luc , can yu please check html command to get proper output . $path1 = 'D:\hc' $path = "D:\hc\compliance-$(Get-Date -Format 'yyyyMMdd-HHmm').html" #(get-credential).password | ConvertFrom-SecureString | set-content "$path1\password.txt" $password = Get-Content "$path1\password.txt" | ConvertTo-SecureString $credential = New-Object System.Management.Automation.PsCredential("administrator@vsphere.local",$password) connect-viserver -server "vcenter01" -Credential $credential $head = @' <style> body { background-color:#dddddd;        font-family:Tahoma;        font-size:12pt; } td, th { border:1px solid black;          border-collapse:collapse; } th { color:white;      background-color:black; } table, tr, td, th { padding: 2px; margin: 0px } table { margin-left:50px; } </style> '@ $esxi=get-vmhost $deviated_esxi=@() foreach($e in $esxi) { $v=get-vmhost -Name $e $accountunlocktime_minutes=(Get-AdvancedSetting -Entity $v -Name Security.AccountUnlockTime).value/60 if($accountunlocktime_minutes -ne "60"){ [PSCustomObject]@{                 esxinmae = $v                                 accountunlocktime_minutes=$accountunlocktime_minutes                                             }             $deviated_esxi += $v             } } $deviated_esxi|ConvertTo-Html -Property name -Fragment -PreContent '<h2>esxiwithlockdowntime not60mins </h2>' |    Out-String    ConvertTo-HTML -head $head -PostContent $deviated_esxi |    Out-String | Out-File -FilePath $path
i have been using disconnect-viserver for both vmhost and vcenter . i am goimg to check this code gain with server paramereter.
i tried following way .i have alreday connected to vcenter.can yu suggest if this code is correct . $cred_root=get-credential $csv_info = Import-Csv C:\users\jvmishra\desktop\root... See more...
i tried following way .i have alreday connected to vcenter.can yu suggest if this code is correct . $cred_root=get-credential $csv_info = Import-Csv C:\users\jvmishra\desktop\root.csv foreach ($line in $csv_info) { $x=get-vmhost $line.esxiname $x $y=$line.password $y Connect-VIServer -server $x -Credential $cred_root Set-VMHostAccount -UserAccount root -Password $y -WhatIf Disconnect-VIServer -server $x -Force -Confirm:$false } also root.csv has following format "esxiname","password" esxi1.infra.local,abc esxi2.nfra.local,xyz esxi3.infra.local,wer
i wnat to know how to use two indexes $[i]  for esxi hosts and $[j] for passord  in foreach loop.
currently i have two differnt txt files for esxi hosts and password respectively. iwil check to see what you suggest to have one file for for both esxi and corrosponding password using import-cs... See more...
currently i have two differnt txt files for esxi hosts and password respectively. iwil check to see what you suggest to have one file for for both esxi and corrosponding password using import-csv way however can this two be combined (my initial post)in same for loop in some way.
hi Luc , can yu suggest if below expression can be modified to correct expression in powershell where $allesxi is an array of esxi hosts and $passwords is an array of corresponding password to... See more...
hi Luc , can yu suggest if below expression can be modified to correct expression in powershell where $allesxi is an array of esxi hosts and $passwords is an array of corresponding password to be set to esxi i want to combine $i and $j iteratot to same foreachloop is it possible ??? $cred=get-credential $passwords=Get-Content C:\users\jvmishra\Desktop\passwords.txt for ($i=0; $i -lt $allesxi.count;$i++)($j=0;$j -lt $passwords.count;$j++) { $allesxi[$i] connect-viserver -server $allesxi[$i] -Credential $cred Set-VMHostAccount -UserAccount root -Password $passwords[$j] -WhatIf }
thanks luc.
thanks iam going to check this if yu can suggest on below in the same thraed $allesxi|?{$_ -notlike $exclude} i need to remove $exclude array (3 itesms here) from $allesxi array .what s... See more...
thanks iam going to check this if yu can suggest on below in the same thraed $allesxi|?{$_ -notlike $exclude} i need to remove $exclude array (3 itesms here) from $allesxi array .what should be the right expression .i can only remove one item usin -notlike operartor .
Hi Luc, can yu suggest something how powershell scripts be made available to vmware orchestrator . i earlier worked on some of the inbuilt workflows which were  out of the box and were writte... See more...
Hi Luc, can yu suggest something how powershell scripts be made available to vmware orchestrator . i earlier worked on some of the inbuilt workflows which were  out of the box and were written in java script . they were available to orchestrator library as vcenter was added as one of the end points .
Hi all, has anyone integarted WFA (netapp) to vRA .can somesone share the basic document about it ?