Thank you LucD I was inspired by your idea, I just have a problem I can't create a LOG file Below the Script : Connect-VIServer -Server X.X.X.X $VMS = Get-Content C:PATH\List_VMs.txt f...
See more...
Thank you LucD I was inspired by your idea, I just have a problem I can't create a LOG file Below the Script : Connect-VIServer -Server X.X.X.X $VMS = Get-Content C:PATH\List_VMs.txt foreach ($vm in $VMS){ New-advancedsetting -Entity $vm -Name isolation.device.connectable.disable -value $true -force -Confirm:$false New-advancedsetting -Entity $vm -Name isolation.device.edit.disable -value $true -force -Confirm:$false New-advancedsetting -Entity $vm -Name isolation.tools.copy.disable -value $true -force -Confirm:$false } Disconnect-VIserver -Confirm:$false
No error received and I have about 10 settings to implement for specif clusters on the first step: "isolation.device.connectable.disable" -value $true "isolation.device.edit.disable" -value $...
See more...
No error received and I have about 10 settings to implement for specif clusters on the first step: "isolation.device.connectable.disable" -value $true "isolation.device.edit.disable" -value $true "isolation.tools.copy.disable" -value $true "isolation.tools.diskShrink.disable" -value $true "isolation.tools.diskWiper.disable" -value $true "isolation.tools.dnd.disable" -value $true "isolation.tools.paste.disable" -value $true "isolation.tools.setGUIOptions.enable" -value $false "log.keepOld" -value "10" "log.rotateSize" -value "1024000"
I created the below script, unfortunaly with some errors [sorry as I'm not yet expert] I'm able to see information on PowerCLI but on the report only one VM is reported # vCenter Login ...
See more...
I created the below script, unfortunaly with some errors [sorry as I'm not yet expert] I'm able to see information on PowerCLI but on the report only one VM is reported # vCenter Login $vCUser="domain\uset" $vCPass="user" # LIST OF vCenter $vCenterIP = "X.X.X.X" # Connection to vCenter foreach ($IPAddress in $vCenterIP){ Connect-VIServer $IPAddress -User $vCUser -Password $vCPass -port 443 } #Variables $Date = Get-Date $Datefile = ( Get-Date ).ToString("yyyy-MM-dd-hhmmss") $ErrorActionPreference = "SilentlyContinue" # Variable to change $CreateCSV= "yes" $GridView = "no" $FileCSV = New-Item -Type File -Path "C:\Report\CheckDisks_VMs_$datefile.csv" Write-Host "Gathering VM Disks Info" $report = @() Get-VM | ForEach-Object { $VM = $_ $_.Guest.Disks | ForEach-Object { $Report = "" | Select-Object -Property VM,Path,Capacity,FreeSpace,PercentageFreeSpace $Report.VM = $VM.Name $Report.Path = $_.Path $Report.Capacity = $_.Capacity $Report.FreeSpace = $_.FreeSpace if ($_.Capacity) {$Report.PercentageFreeSpace = [math]::Round(100*($_.FreeSpace/$_.Capacity))} $Report } } #Output if ($GridView -eq "yes") { $report | Out-GridView } if ($CreateCSV -eq "yes") { $report | Export-Csv -LiteralPath $FileCSV -UseCulture -NoTypeInformation } #Disconnect session from VC Disconnect-VIserver -Confirm:$false
It's Ok when I open the CSV using Notepad++ or if I open it directly in excel but if I import it it add the line it's fine and thank you for your help stay safe
Thank you it's working just the CSV obtained when I open it in Excel the first line containe : Column1, Column2, Column3 and the second line contain VM, Name, Value is there any way to de...
See more...
Thank you it's working just the CSV obtained when I open it in Excel the first line containe : Column1, Column2, Column3 and the second line contain VM, Name, Value is there any way to delete the first line?
I have a big list of VMs and they are on different Hosts and managed by differentes vCenter. I'm trying to create a script in order to get all Advanced Settings in order to correct them based on...
See more...
I have a big list of VMs and they are on different Hosts and managed by differentes vCenter. I'm trying to create a script in order to get all Advanced Settings in order to correct them based on audit report. I'm using the below script and it return 0 details: # vCenter Login $vCUser="domain\user" $vCPass="PASSWORD" # LIST OF vCenter $vCenterIP = "X.X.X.X" foreach ($IPAddress in $vCenterIP){ # Connection to vCenter Connect-VIServer $IPAddress -User $vCUser -Password $vCPass -port 443 } #Variables $Date = get-date $Datefile = ( get-date ).ToString("yyyy-MM-dd-hhmmss") $ErrorActionPreference = "SilentlyContinue" # Variable to change $CreateCSV= "yes" $GridView = "no" $FileCSV = New-Item -type file "C:\Report\VMWARE_REPORT_$datefile.csv" $output += ‘<H1>[2017 - Report Monthly Virtual Machine</H1>’ $output += ‘<H2>Date and time</H2>’,$date Write-Host "Gathering VM statistics" $report = @() foreach($vm in Get-View -ViewType Virtualmachine){ Get-VM $server| Get-AdvancedSetting | Select Name, Value } #Output if ($GridView -eq "yes") { $report | Out-GridView } if ($CreateCSV -eq "yes") { $report | Export-Csv $FileCSV -NoTypeInformation } #file CSV $filename = "C:\Report\VMWARE_REPORT_$datefile.csv" #Disconnect session from VC Disconnect-VIserver -Confirm:$false
it's Ok now and I'm able to connect to 2 vCenter but regarding $global:defaultviservers I don't have this variable in the script that I'm using. I'm using the script that I find here Report...
See more...
it's Ok now and I'm able to connect to 2 vCenter but regarding $global:defaultviservers I don't have this variable in the script that I'm using. I'm using the script that I find here Report_VirtualMachine.ps1
Would you please help me to understand how we can connect to different vcenter using PowerShell script? I started with this lines, unfortunately each time I add a vcenter to this script it xonne...
See more...
Would you please help me to understand how we can connect to different vcenter using PowerShell script? I started with this lines, unfortunately each time I add a vcenter to this script it xonnect to last one on the list: #Initialize PowerCLI add-pssnapin VMware.VimAutomation.Core # vCenter Login $vCUser="domain\user" $vCPass="Password" # LIST OF vCenters $vCenterIP = "x.x.x.x" $vCenterIP = "x.x.x.x" foreach ($IPAddress in $vCenterIP){ # Connessione a vCenter Connect-VIServer $IPAddress -User $vCUser -Password $vCPass -port 443 }