PowerCLI script to check the setting of syslog on a whole cluster?
Hey guys,.
I'm looking for a way to check the setting configured for syslog remote on a large cluster of ESXi. Is it possible to easily check by cluster?
Thanks in advance,
The following PowerCLI script will give you the servers remote syslog for all hosts in a cluster:
Get-Cluster "MyCluster" | Get-VMHost | ForEach-Object { $VMhost = $_ $VMHost | Get-VMHostSysLogServer | ForEach-Object { $Report = "" | Select-Object -Property VMHost,SyslogServer,Port $Report.VMHost = $VMhost.Name $Report.SyslogServer = $_.Host $Report.Port = $_.Port $Report } }
Best regards, Robert
Tags: VMware
Similar Questions
-
Script to check the DRS VM groups?
Hello guys,.
I want to know if you could give me an idea on how to check the DRS of VM groups on my cluster.
DRS group are created with a shared identifier that is common on the VM too. For example: VMS DRS group R125 must include each VM name "R125" is included (such as VM-R125-001).
First of all, I would like to work on a script that will be able to detect if certain VM are not in their groups of DRS corresponding VM (by listing for example) and later add an e-mail notification if possible.
I would like to know if you could give me some advice on how to run this script, what cmdlet should I use, etc.
Thank you very much
Kind regards
Benedict.
EDIT: VM DRS group and not of DRS rules
Try like this
Import-Module DRSRule
#
# Specifications cluster
$cluster1 = "ClusterName".
$cluster = get-Cluster-name $cluster1
#
#for each customer ID.
foreach ($Group in (Get-DrsVMGroup-Cluster $cluster))
{
# Get all the virtual machines that match the groupID
$vms = get-VM-name 'vm-$($Group.Name)-01"- location $cluster | Select name
# Compare 2 results
$result = compare-Object - referenceobject $Group.VM - DifferenceObject $vms
# Display the result
Write-Output "missing DRS rule $([string]: join (($result |))). where {$_.} SideIndicator - eq "=>"} | Select ExpandProperty - InputObject,)' | ')) »
Write-Output "be deleted from the rule DRS $([string]: join (($result |))). where {$_.} SideIndicator - eq '<='} |="" select="" -expandproperty="">='}>
}
-
Can write us "PowerCLI Script" to get the details of card RAID HP (Firmware & Driver)
For example: native ESX command below shows desired output for me.
But we needed equality PowerCLI ESX command below script
# cat/proc/driver/cciss/cciss0
cciss0: HP Smart Array P400i controller
Board ID: 0x3235103c
Firmware version: 7.22# cat/proc/driver/hpsa/hpsa0
hpsa0: HP Smart Array P410i controller
Board ID: 0x3245103c
Firmware version: 5,70
Driver version: HP HPSA driver (v 5.0.0 - 17vmw)
The extracted following PowerCLI you will get server and type of controller, firmware version and the hpsa/Smart Storage Array controllers driver version based of:
Get-VMhost | Sort | Select Name, Model,@{N='Controller Type'; E={(Get-VMHostHba -VMHost $_ | ? {$_.Model -imatch '.*(hpsa|smart).*'}).Model}},@{N='Controller Firmware'; E={($_.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | ? {$_.Name -like '*hpsa*firmware*'}).Name}},@{N='hpsa Driver Version'; E={($_.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | ? {$_.Name -like '*scsi-hpsa*'}).Name}} | Format-Table -Autosize
The sample output:
Name Model Controller Type Controller Firmware hpsa Driver Version---- ----- --------------- ------------------- -------------------esxihost1022.local ProLiant DL380 G6 Smart Array P410i HP Smart Array Controller HPSA1 Firmware 6.40 Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1023.local ProLiant DL380 G6 Smart Array P410i HP Smart Array Controller HPSA1 Firmware 6.40 Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1024.local ProLiant DL380 G6 Smart Array P410i HP Smart Array Controller HPSA1 Firmware 6.40 Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1033.local ProLiant DL360p Gen8 Smart Array P420i HP Smart Array Controller HPSA1 Firmware 5.42 Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1034.local ProLiant DL360p Gen8 Smart Array P420i HP Smart Array Controller HPSA1 Firmware 5.42 Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1041.local ProLiant DL380 G5 Smart Array P400 HP Smart Array Controller HPSA1 Firmware 7.24 VMware scsi-hpsa 5.0.0-17vmw.500.0.0.469512 2011-08-19 01:58:59.000esxihost1042.local ProLiant DL380 G5 Smart Array P400 HP Smart Array Controller HPSA1 Firmware 7.24 VMware scsi-hpsa 5.0.0-17vmw.500.0.0.469512 2011-08-19 01:58:59.000esxihost1160.local ProLiant BL460c Gen8 Smart Array P220i HP Smart Array Controller HPSA1 Firmware 5.22 Hewlett-Packard scsi-hpsa 5.0.0-40OEM.500.0.0.472560 2012-08-24 21:04:51.000esxihost1161.local ProLiant BL460c Gen8 Smart Array P220i HP Smart Array Controller HPSA1 Firmware 5.22 Hewlett-Packard scsi-hpsa 5.0.0-40OEM.500.0.0.472560 2012-08-24 21:04:51.000
-
Using Script to check the version of Adobe Reader software
Hello. I am now currently using LiveCycle Designer to create a form that allows users to attach attachments. We found that if a user uses Adobe Reader 7.0 or below, there is a problem on fixing attachments. Accordingly, we would like to add a script to check the version of the Adobe Reader client in a ready state of the form. If a user uses Adobe 7.0 or below, the message box opens and suggests the user to download a more recent version of the Adobe Reader software. I would like to know is possible to do so. Thank you very much
Hello
the script might look like:
If (typeof (app.viewerVersion)! = "undefined")
If (app.viewerVersion<>
{
xfa.host.messageBox ("your Version of Adobe Reader is old...");
}
}
You can use it in the docReady:Event of your form to inform users.
-
PowerCLi script to check if 2 virtual machines are on the same host
Hello
I'm nubby on PowerCLI and I would like to help in the construction of a script.
The script should check if two virtual machines (named test1 and test2) are running on the same host in a vCenter and send a notification (email), if they do.
Something similar with affinity / anti-affinite DRS rules (but not through the DRS enabled on vCenter). My focus is on the affinity. In case this happens, I need vMotion one of them on an another ESXi host(manually or automated).
What I have done until now is the following:
Get - VM | Select Name, @{N = 'Cluster'; {E = {Get-Cluster - VM $_}}, '
@{N = "ESX host"; {E = {Get-VMHost - VM $_}}, '
@{N = 'vCenter'; E={$_. "(ExtensionData.CLient.ServiceUrl.Split('/') [2]}}, '"
@{N = "Datastore"; {E = {Get-Datastore - VM $_}} | `
Export-Csv - NoTypeInformation C:\Scripts\file.csv
That becomes all the VMS and export a CSV file information:
Name Cluster ESX host vCenter Data store test2 cluster_test ESXi_test1 vCenter_test1:443 datastore1 Test1 cluster_test ESXi_test1 vCenter_test1:443 datastore1 For1.local cluster_test ESXi_test1 vCenter_test1:443 datastore1 VM1.local cluster_test2 ESXi_test2 vCenter_test1:443 datastore1 VM2.local cluster_test3 ESXi_test3 vCenter_test1:443 datastore1 VM31.local cluster_test3 ESXi_test3 vCenter_test1:443 datastore1 Thank you.
Try like this.
$tgtVM = "test1", "test2".
Get-VM-name $tgtVM | Group-object - property VMHost | %{
if($_.) County - gt 1) {}
$vm = $_. Group | Get-Random
$esx = $vm. VMHost
$tgtEsx = get-Cluster - $vm VM | Get-VMHost | where {$_.} Name - not $esx. Name} | Get-Random
Move-VM - $vm - Destination $tgtEsx VM - confirm: $false
}
}
-
Script to check the correct resource pools
Hi guys
Hoping someone can help with PowerCLI issue?
I want to set up a script PowerCLI who together share CPU and memory allocated to all VMS in each Resource Pool, add them together and compare them with resource information in the list of resources and those who differ from a CSV output (including how on every property is different).
The idea is that this script will quickly check through our vast domain for incorrectly configured in the resource pools (ie. those who have not been updated).
Anyone able to help give advice on how I can get that data into PowerCLI from the pool of resources and the virtual computer?
Thank you very much
-
a crazy penguin
I don't know if the values you provide are correct for what is planned.
Especially the MaxCpuUsage won't say much because this will normally reflect the total amount of CPU resources on the host (provided that the customer has no defined limits).
The following should give a better picture (I guess)
$dcName =
$report = @() $dc = Get-View -ViewType Datacenter -Filter @{"Name"=$dcName} Get-View -ViewType ResourcePool -SearchRoot $dc.MoRef | where{$_.Name -ne "Resources"} | %{ $rp = $_ $rpMem = 0 $rpCpu = 0 Get-View -ViewType VirtualMachine -SearchRoot $rp.MoRef | %{ $rpMem += $_.Summary.QuickStats.hostMemoryUsage $rpCpu += $_.Summary.QuickStats.overallCpuUsage } $report += New-Object PSObject -Property @{ Name = $rp.Name "VmCpuTotal (MHz)" = $rpCpu "VmMemTotal (MB)" = $rpMem RpCpu = $rp.Runtime.Cpu.UnreservedForVm RpMem = $rp.Runtime.Memory.UnreservedForVm / 1MB } } $report | Export-Csv "C:\ResPool.csv" -NoTypeInformation -UseCulture Note that this does not overcommitment account. To have the script must use the unreservedForPool rather than the UnreservedForVm property property.
-
Change the PowerCLI Script to use the DRS and DRS storage
Hello
I have a PowerCLI script that specifies a host and a data store to create a new virtual machine, which has served us well. Now we have activated the DRS and DRS storage and I wonder what to change in order to take advantage of these features. Are there commands to specify a cluster and the cluster data store and let the DRS to decide the initial investment for a new virtual machine? At the moment we put all hosts and the warehouses of data as variables and use them in the line below.
Thank you.
$newVM = New-VM-name $NewVMname - VM $TemplateName Datastore - $datastore - VMHost $vHost - confirm: $false - location $myName
You set a Datastorecluster?
If Yes, then you can replace the value of parameter data with the datastorecluster object store.
Replacing a VMHost with a cluster is not taken in charge I'm afraid.
But you can use something like this
New-VM-name TestVM Datastore - DSC - ResourcePool (Get-Cluster-name mycluster |) Get - Resourcepool - name of resources)
This will automatically select the VMHost.
The virtual machine appears in the root of the cluster.
DSC is the name of a datastorecluster in the cluster mycluster
-
Apple script to check the part of iTunes XML library with other applications.
Y at - there no apple for script
Check "Sharing iTunes library XML with other applications." Of
- iTunes
- Preferences
- Advanced tab...
I want to read itunes Media Library .xml but lates itunes no xml is created by default,
so I want this XML created by my application through the apple script.
iTunes12.4
https://discussions.apple.com/message/28513383#28513383 - new with the parameter preferably 12.2 iTunes to turn create .xml
If you really want an AppleScript, I think you should ask on the iTunes for Mac forum, or maybe the OSX Technologies.
-
PowerCLI script to display the number of vCPU by VMhost use
Hi all
I'm looking to get help here with powerCLI script to list each total number of ESXi vCPU host that is used to determine if there are any ESXi host CPU is more engaged.
According to suggestion of performance in some blog vExpert, is around 1: 3 of Jepp core ratio: vCPU allocated, then how to display the report with the powerCLI for something like this:
PRODESXi01
Total of nuclei available: 32
Used by the virtual machine: 28PRODESXi02
Total of nuclei available: 32
Used by the virtual machine: 38So according to the result above, the PRODESXi02 is more committed by 6vCPU allocated to the virtual machine.
Note: The available total carrots is taken from the value of logical processors from the contents tab, when you click on the vSphere console.
How to get this report using PowerCLI?
Thank you
You mean something like this?
{Foreach ($esx in Get-VMHost)
$vCPU = get-VM-location $esx | Measure-object-property NumCpu-sum | Select - ExpandProperty sum
$esx | Select Name,@{N='pCPU'; E={$_. NumCpu}},
@{N = 'vCPU'; E = {$vCPU}},
@{N = "Ratio"; E = {[math]: Round ($vCPU / $_.)} (NumCpu, 1)}}
}
-
Script to check the speed and duplex
Hey all,.
I've been looking and trying to find a script to export to a CSV one sheet simple display of speed and duplex of physical network adapters in our environment. Any advice would be greatly appreciated!
Get-VMHostNetworkAdapter |? {$_. Name: match "vmnic" - and $_. {BitRatePerSec - only '0'} | Select vmhost, name, BitRatePerSec, FullDuplex | Export-CSV-Path "C:\PowerCLI Scripts\Reports\VMNICs.csv" - NoTypeInformation - UseCulture
The above should work. Have no PowerCLI on my phone to test if
-
PowerCLI script to list the df - hl on all ESX hosts?
Hi Expert,
I have more than 100 esx host, and I need to list all the df - hl out for my report. Y at - it instead of connect on each esx host to get under output, powercli script that I can use to remove similar information?
Size of filesystem used Avail use % mounted on
/ dev/sdaa2 20G 1.5 G 17G 8%.
/ dev/CCISS/c0d0p1 1.1 G 118 M 909 M 12% / Boot
/ dev/sdaa6 9.7 G 151 M 9.0 G 2% / Home
/ dev/sdaa7 9.7 G 151 M 9.0 G 2% / tmp
/ dev/sdaa5 9.7 G 317 M 8.9 G 4% / var
/ dev/sdaa8 494M 212 M 257M 46% /vmimages
Please advice. Thank you
Are you allowed to enable SSH on servers ESX (i)?
And are you allowed to establish a SSH session on each ESX (i) Server?
You have an account and a password on each ESX (i) server that can run the command 'df '?
If it is Yes, then you can use something like plink.exe in consequence of PuTTY to connect to each ESX (i) server, run the command "df" and retrieve the output.
There are several available examples to use plink.
And don't forget that you will need a fingerprint for each server ESX (i) will be stored on the client from which you are running the script.
-
Script to check the version of Cisco VEM on ESXi host
Hallo,
I need help, a script to check and report in a CSV file, the version of Cisco Nexus 1000v VEM on all ESXi hosts connected to a vCenter.
Basically, "vem version - v" but for all the ESXi hosts connected to a vCenter.
Thank you
Joseph
I suspect you could use PowerShell v1, in this version that the Export-Csv has not had the UseCulture parameter.
Try to run the script without this parameter.
But I would strongly suggest to upgrade your version of PowerShell (v3 is available)
-
PowerCli Script to change the VM Options?
Is it possible to use PowerCli to change the options for a virtual computer? Specifically, I would like a PowerCli script to select control of boxes on a virtual machine under Options-> VMware Tools-> advanced settings until the VMware Tools are upgraded during the feeding cycle and the time is sync would be.
Thank you
JD
Here's what we use if you want to pull from a text file.
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec $vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo #$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual" $vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle" Get-Content -Path "C:\names.txt" | %{ (get-vm -Name $_).Extensiondata.ReconfigVM($vmConfigSpec) }
-
who to check the setting in the procedure or the oracle Packagusing Defualt table
Hello
My question is who to check the procedure parameter or a Package using the default oracle as a table
user_procedure, we will have any kind of the PKG, PROCEDURE etc...
same as if I wan't to see the partial procedure that eventually all the setting that to check?Hello
870003 wrote:
HelloMy question is who to check the procedure parameter or a Package using the default oracle as a table
user_procedure, we will have any kind of the PKG, PROCEDURE etc...
same as if I wan't to see the partial procedure that eventually all the setting that to check?
The data dictionary includes teas views:
USER_PROCEDURES that has one row per stored procedure in your schema
$user_arguments which has one line per parameter (or argument) to each stored procedure or a function in your schema
USER_OBJECTS who has one line per package, package body, procedure or function in your schema. (It includes tables, synonyms, etc., but you can question him saying ' WHERE object_type IN ('PACKAGE', 'BODY of PACKAGE', 'PROCÉDURE', 'FUNCTION') ")
USER_SOURCE who has one line of code in one of your packages, package bodies, procedures or functionsThere are also views starting with ALL_ (such as ALL_PROCEDURES, ALL_ARGUMENTS,...) for objects in any schema that you are authorized to use.
There are also views starting with DBA_ (for example, DBA_PROCEDURES,...) for objects in any schema, if you have privileges on them or not, but you are not privileges to see the DBA_ views. -
SQL script to check the status of the last command
Hi all
I need to make a SQL script and call it from Unix (bash) shell.
=========================
sqlplus vikas/vikas < < END
coil /oracle/vikas/output.txt
order 1
command 2
...
....
command N
spool off;
commit;
END
=========================
It works perfectly, but my problem is that if a command fails, the other controls in suite works. However, I need to keep a check when a broken command that you exit the script.
On unix, we have an option of echo $? to check the status of the previous command, but how to accomplish this SQL.
Pls help!
__________________
== > VIKAS < ===========================
sqlplus vikas/vikas<>
coil /oracle/vikas/output.txt
WHENEVER SQLERROR EXIT; -Add this
order 1
command 2
...
....
command N
spool off;
commit;
END
=========================
Maybe you are looking for
-
How can I send an email to multiple recipients without showing all recipients
I want to send an email to a group of people but do not want all the names or the displayed addresses.
-
Hi I have a M200 which I use as well in the form of tablets & to my office as my workstation. I run a 17 "LCD screen directly to the M200 with no docking station. I want to be able to extend my desktop on the M200 LCD screen, while the main office re
-
In my iTunes folder on my iMac, I have some confusing subfolders. In my iTunes folder Music under my user name, in addition to my music folder where most of my music is stored, I also shows the following as I dig: In iTunes Music, I have the followin
-
ProBook 4520 s - HP Recovery Manager?
Hi- I have a new Probook 4520 s, product #XT989ut, Windows 7 Professional factory-installed. I got no CD, DVD or any other media. I want to make a system image backup, I can restore it on a new hard drive full hard drive failure. HP Recovery Manage
-
Impossible to get Netflix instant spy to work
I've been with Netflix for years. Have used quick watch since it was started. Thursday, I got a screen black with error 2103 indicating there was a problem with Silverlight and unistalling and then reinstalilng usually solved the problem. I did it.