script to retrieve host Syslog parameters

Dees someone at - it a script to extract the Syslog host settings? The output file must contain the hostname entry and syslog. I don't want to change the settings automatically, I only check to ensure that all guests have an entry.


Thank you

Hello, -.

You can use the Get-VMHostSyslogServer cmdlet to get this info.  As:

Get-VMHost | %{$oSyslogEndpoint = Get-VMHostSysLogServer -VMHost $_; Select-Object -InputObject $_ `    name,@{n="SyslogSrv"; e={$oSyslogEndpoint.Host}},@{n="SyslogPort"; e={$oSyslogEndpoint.Port}}}

That would have produced something like:

Name                  SyslogSrv    SyslogPort
----                  ---------    ----------
myHost0    oursyslogSrv.dom.com           514
myHost1    oursyslogSrv.dom.com           514
myHost2
myHost3    oursyslogSrv.dom.com           514

.. where there are no values for SyslogSrv and SyslogPort if the VMHost has not configured Syslog server.  And, if you want to export to a file, you can add "|" Export Csv - UseCulture - c:\temp\VMHostSyslogInfo.txt NoTypeInfo"at the end.  What to do for you?

Tags: VMware

Similar Questions

  • Please share the Script to retrieve the name of host, HBA, HBAstatus, WWN, pathpolicy and dualpathinfo

    Please share the Script to retrieve the name of host, HBA, HBAstatus, WWN, pathpolicy and dualpathinfo

    Take a look on Re: information on the host hardware with information about the HBA drivers and nic

  • Need help to change a creation of VM PowerCLI script to support host ESXi and vCenter

    I have the below script that I created with much help from LucD - thank you! This has served me well for my lab procedures rip - replace so far. This script works when I run it against my single ESXi host when it is not connected to my server vCenter, but it throws errors when I run this script when the host is connected to vCenter and it fails to implement the controller SCSI Paravirtual. I think when the host is under the control of vCenter that changed some of the settings.

    If I point to the vCenter instead of ESXi host, I still get the same problem. In addition, I would also add the ability to create virtual machines in pools of different resources of a cluster of vSphere. My name in data center's LAB and my Cluster is called Local with pools of resources like TestLab, etc. see Horizon.

    Ideas please!

    Error message:

    Set SCSI controller: 21/10/2014-18:02:11SCSI controller setFailure of the operation for the entity 'W81X86 '.

    with the following message: "access to the parameters of resources on the host computer is the server manages:

    '192.168.1.5 '. »

    Get-SCSI - VM $VM controller | where {$_.} Type - eq "VirtualLsiLogicSAS"} | All-CBS...

    ~~~~~~~

    + CategoryInfo: NotSpecified: (:)) [game-SCSI controller], HostAccessRestrictedToManagementServer)
    + FullyQualifiedErrorId: Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed, VMware.VimAutomation

    . ViCore.Cmdlets.Commands.VirtualDevice.SetScsiController

    The real script:

    # Create Virtual Machines LAB of CSV file

    Add-PSSnapin-name "VMware.VimAutomation.Core" - ErrorAction SilentlyContinue

    Game-PowerCLIConfiguration - ignore InvalidCertificateAction - confirm: $False | Out-Null

    $ESXHost = "192.168.1.10".

    $DelayValue = "5000" # 5 seconds startup time

    $vmConfigSpec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $vmConfigSpec.BootOptions = new-Object VMware.Vim.VirtualMachineBootOptions

    $vmConfigSpec.BootOptions.BootDelay = $DelayValue

    $vmConfigSpec.BootOptions.bootOrder += new-Object VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice

    $vmConfigSpec.flags = new-Object VMware.Vim.VirtualMachineFlagInfo

    $vmConfigSpec.flags.enableLogging = $false

    $net = new-object - ComObject WScript.Network

    $net. MapNetworkDrive ("b", "\\192.168.1.3\Build", $false, "", "")

    to connect-VIServer-server '$ESXHost'-'root' user - password to 'P@ssw0rd '.

    Import-CSV B:\LabBuild\Lab.csv - UseCulture | %{

    $disks = @($_.) HD1)

    if($_.) HD2 - not 0) {}

    $disks += $_. HD2

    $vm = New-VM - VMhost $ESXhost - Name $_. VMName - MemoryMB $_. MemoryMB - NumCPU $_. NumCPU-Version $_. Version - ID $_. ID-floppy - Datastore $_. Data-DiskGB $disks - DiskStorageFormat 'Thin' store - resourcepool $_. RPool-note $_. Notes - CD #-RunAsync

    Get-CDDrive - VM $vm | Game-CDDrive - ISOPath $_. ISOPath - StartConnected $true - confirm: $false | Out-Null

    Get-NetworkAdapter - VM $vm | Together-NetworkAdapter NetworkName-$_ .NetworkName-$_.NetworkType to confirm Type: $False | Out-Null

    FloppyDrive get - VM $vm | Game-FloppyDrive - FloppyImagePath $_. FloppyPath - StartConnected $true - confirm: $false | Out-Null

    Get-SCSI - VM $VM controller | where {$_.} Type - eq "VirtualLsiLogicSAS"} | Set controller SCSI-type Paravirtual

    $vm. ExtensionData.ReconfigVM_Task ($vmConfigSpec) | Out-Null

    }

    #This line verifies the powerstate and POWER ON VM to start the installation

    #$vmState = get - VM $vm | Select-Object PowerState

    # If ($vmState - matches "ff") {Get - VM $vm |} Start-VM}

    }

    The Destination parameter in the cmdlet Copy-DatastoreItem takes an object that specifies a folder or file on the data store.

    Take a look at KB2001041, he explains the cmdlet and parameter more in detail.

  • V21 Firefox cannot find the files if file *.htm used "style windows" path slashes to the java scripts (on Unix, hosting with apache)

    Hello. I find a strange behavior of Firefox v21. If the 'windows' path used *.htm file slashes to the java scripts (on Unix, hosting with apache). Firefox says 404, but other browsers (such as Opera, Chrome, IE10) works properly with this.

    You should use slashes in links so that they work properly in Firefox, otherwise Firefox will escape them that 5% C as you can see if you would them hover in the case of a real link (this is obviously not possible in this case).

  • I need to write a vbscript script to retrieve the size of an access database

    Could someone help me write a vbscript script to retrieve the size of an access database. I need to put this in my schedular system to run every morning.

    Hi Rob,

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Office IT Pro. You can follow the link to your question:

    http://social.technet.Microsoft.com/forums/en-us/officeitpro/threads

  • Remove data for a downgraded ESXi host syslog collector?

    Hello

    We already put out of service an ESXi 5 host in the cluster.

    However, network Syslog Collector, the host still appears with the hostname / IP address and the size of the log (about 18 MB).

    We would like to seek your advice on how to remove this entry to ESXi host Syslog collector Page.  Should I restart the service "VMware vSphere Syslog Collector" on vCenter Server?

    Thank you

    Post edited by: TonyJK

    If the server esxi already downgraded in judgment of sate, then you can delete the syslog file (in vcenter) to as esxi. If the underwater ESXI still running, you can disable forewall port for syslog (even if you can remove the host name of the syslog setting advanced collector.)

  • Cannot retrieve host associated with a substituent VMs

    Hi guys.

    This is my setup:

    vSphere 5.1

    Main site (Production)

    Cluster, 7 guests.

    Compellent primary storage (with the Manager of the own company compellent).

    vCenter own VM

    a few replicant vms (with a server of domain names).

    Secondary site (remote)

    Cluster, 3 guests

    Secondary Compellent storage (with the Manager of the own company compellent).

    vCenter own VM.

    VM site recovery manager.

    No domain name server.

    So, when I test the recovery plan is working perfectly. Yesterday, I tried an exercise in failure:

    1 - Disconect link between the Production Site and the remote location.

    2. - connect my laptop in the Remote Site lan.

    3. - connect the vSphere Client in vCenter Secondary Site.

    4 - action for run for the stimulus plan.

    but fails when try to power of virtual machines. Error:

    Error: Cannot retrieve host associated with a substituent VMs. The connection to the remote server is down.

    There is something wrong with my setup, but why? I do not know. I check and rechek but I don't see the wrong configuration.

    Plese help. Any suggestion will be appreciated.

    Another question.

    My direct area on Site of Production secondary and primary servers. Is good practice developed a third active area living in a Remote Site Server?

    Greetings.

    Reason: this problem may occur if a virtual machine with the same name as the virtual computer space reserved already exists in inventory of vCenter Site Recovery SRM.

    To resolve this problem, try one of these options and make sure that there is no conflict of virtual machine name:

    1. change the name of the virtual machine that requires the protection of the protected Site.

    2 If the virtual machine on the recovering Site is necessary, change the name of the virtual machine for recovery Site.

    3. If the virtual machine on the recovering Site is not necessary (perhaps because it's an old placeholder virtual machine or a virtual machine created by mistake), remove the virtual machine from the inventory.

  • Script to keep the monitoring parameters of VM to 'Disable '.

    I'm looking for a way to create a script to keep the monitoring parameters of VM to 'Disable '. Here's my question:


    Symantec ApplicationHA requires that the 'Follow-up of the VM' option under VMware HA fixed "VM and Application monitoring. If I set this parameter as already said, all the virtual machines in the cluster gets 'Use the parameters of Cluster' and they are part of the surveillance with risk of unexpected VM resets. So I'm going to select 'Disable' for all virtual machines leaving only a couple of VMs who must actually followed even with a reset the virtual machine.

    Challenge

    1. How to get this applies with a script. There are hundreds of virtual machines, I need to adjust the monitoring to disable.
    2. Virtual machines continue to add to the cluster and they get 'use the Cluster setting' default and someone had to keep track of these and follow up on "Disable" the value manually.

    I want to know if there is a way, it can be script to change the setting "VM Monitoring" to "Disable" as well as the new creation of VM.

    Thanks in advance for your help.

    VM Monitoring.png

    Hello, vSphereUser7-

    Mhmm... And updated two values I mentioned that you should use in your environment?

    0) the name of the folder that contains the virtual machines to keep tracking enabled on

    (1) the name of the cluster whose update settings

    And, looking at the code, it would have a degree more to add in the DasSettings of the specification of the config.  This will only act on the virtual machines for which the settings of the virtual machine for monitoring have been changed in the HA cluster settings, I see.  So, it can act on all the virtual machines you want.

    I saw your other thread at http://communities.vmware.com/message/1858996#1858996, where refer you to the post of Damian Karlson on the (http://damiankarlson.com/2011/01/13/managing-vmware-has-vm-monitoring-powercli/).  Method of Damian to disable monitoring on a VM would be a nice way to do it.  In developing his technique and performing the config for multiple virtual machines, you could do it like:

    $strMyClusterName = "myCluster"## get the .NET View object of the cluster, with a couple of choice properties$viewMyCluster = Get-View -ViewType ClusterComputeResource -Property Name, Configuration.DasVmConfig -Filter @{"Name" = "^${strMyClusterName}$"}
    
    ## make a standard VmSettings object$dasVmSettings = New-Object VMware.Vim.ClusterDasVmSettings -Property @{    vmToolsMonitoringSettings = New-Object VMware.Vim.ClusterVmToolsMonitoringSettings -Property @{        enabled = $false        vmMonitoring = "vmMonitoringDisabled"        clusterSettings = $false    } ## end new-object} ## end new-object
    
    ## create a new ClusterConfigSpec object with which to reconfig the cluster$oClusterConfigSpec = New-Object VMware.Vim.ClusterConfigSpec## for each VM View, add a DasVmConfigSpec to the ClusterConfigSpec objectGet-View -ViewType VirtualMachine -Property Name -SearchRoot $viewMyCluster.MoRef | %{    $viewThisVM = $_    ## the operation for this particular DasVmConfigSpec; if a spec already exists for the cluster for this VM, "edit" it, else, "add" it    $strOperationForThisVM = if ($viewMyCluster.Configuration.DasVmConfig | ?{($_.Key -eq $viewThisVM.MoRef)}) {"edit"} else {"add"}    $oClusterConfigSpec.DasVmConfigSpec += New-Object VMware.Vim.ClusterDasVmConfigSpec -Property @{        operation = $strOperationForThisVM     ## set the operation to "edit" or "add"        info = New-Object VMware.Vim.ClusterDasVmConfigInfo -Property @{            key = [VMware.Vim.ManagedObjectReference]$viewThisVM.MoRef            dasSettings = $dasVmSettings        } ## end new-object    } ## end new-object} ## end foreach-object
    
    ## reconfigure the cluster with the given ClusterConfigSpec for all of the VMs$viewMyCluster.ReconfigureCluster_Task($oClusterConfigSpec, $true)
    

    I simplified the creation of an object a little and added specifications of configuration of computers all virtual config spec a single cluster, so that just ReconfigureCluster() only once.

    It is important to note that the specifications being created to update the monitoring parameters given VM can have a type of operation of 'Add' or 'change '.  If we changed the parameter a VM in the HA settings for the cluster, it creates an Configuration.DasVmConfig object for this virtual machine.  The functioning of these virtual machines must be 'Edit '.  Otherwise, you have to 'Add '.  See the commented line in the code that deals with this topic.

    If you do not have that correct property creating the specification, you will get an error (in the vSphere client) as the cluster reconfig task tries to complete: "specified parameter was not correct."

    Copy the following code disables tracing for all the virtual machines in the given cluster (adjust the name of cluster variable before you run).  You could exclude the virtual machines that you want to continue to follow (or change in the GUI at will), or run a similar code to allow follow-up again for desire, VMs, or...

    How does do for you?

  • Calling shell script program SQL and passing parameters

    Hi guys,.
    Greetings from Toronto. Is it possible to move one or more strings as parameters to a sql from shell script program?

    Shell script
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
     
    sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    SQL program (rd_test.sql)
    -- Accept system input parameters
    define p_user_id = &1
    define p_job_id = &2
    
    -- Wondering if its possible to pass these 3 parameters from a shell script program.
    -- (1) rd_test-$p_job_id-3-1.lis
    -- (2) RD_PRINTER(rd_test,3)
    -- (3) t_data
    
    select
    t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    t_data_dir=''.''
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'
    exit_status=$?
    check_command'
    from rd_job_parameter b, rd_job_parameter a
    where a.job_id = &2
    and a.jp_module_id = 'RDTEST'
    and b.job_id = a.job_id
    and b.module_id = a.module_id
    /
    As always, this is not something I have to solve that minute. Any help would be appreciated
    and I will think of the problem.

    Thank you
    REDA

    Published by: Raj404261 on June 25, 2009 11:40

    Published by: Raj404261 on June 25, 2009 17:29

    OK, just a few pointers possible if you need to go the way of shell script.

    I suggest that you have a separate SQL script for each of your options, which retains the fairly well-defined lines and keeps the maintenance as simple as possible. Therefore, in your shell script, you can have something like:

    #!/bin/ksh
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    
    # Deduce which script you'll call here
    # using if statements, or even a case:
    
    if [[ p_job_id -eq 1 ]]
    then
      SQL_SCRIPT=sql_script1.sql
    else
      SQL_SCRIPT=sql_script2.sql
    fi
    
    # Or using case
    
    case $2
      in
        1)     SQL_SCRIPT=sql_script1.sql;
    
        2)     SQL_SCRIPT=sql_script2.sql;
    
        3)     SQL_SCRIPT=sql_script3.sql;
    
        *)     SQL_SCRIPT=sql_script4.sql;
    esac
    
    export ${SQL_SCRIPT}
    
    #If you need to query the database at all to deduce which script to cal
    #Then something like this:
    
    SCRIPT_VAR=`sqlplus -s username/password << EOF
    set heading off
    set feedback off
    set verify off
    SELECT * FROM DUAL;
    EOF`
    
    export {SCRIPT_VAR}
    
    SQL_SCRIPT=sql_script${SCRIPT_VAR}.sql
    
    # Then just call your script:
    sqlplus. -s $p_user_id/password @${SQL_SCRIPT}
    
  • get a host with syslog parameters list?

    I'll change our syslog server port. I can accomplish this with the following:

    Set-VMHostSysLogServer -SysLogServer 'x.x.x.x:xxx' -VMHost '*'
    

    After that I ran this I wanted to doublecheck that everything has been done. When I run the following, I get only the syslog server port, but not the name of the host. How can I get that it displays the name of the host as well? maybe even export to CSV?

    Get-VMHost | Get-VMHostSysLogServer
    

    Thank you.

    You should be able to do it with a calculated property

    Get-VMHost | Select Server Name,@{N="Syslog; {E = {Get-VMHostSysLogServer - VMHost $_}}

    And to export the data to a CSV file, simply use the pipeline

    Get-VMHost | Select Server Name,@{N="Syslog; {E = {Get-VMHostSysLogServer - VMHost $_}} |

    Export-Csv "C:\report.csv" - NoTypeInformation - UseCulture

  • Script to retrieve logs ESX host

    We have a situation where you have to pull up to some log files from each ESX host in a cluster to send...

    log files such as esx.conf, and/proc/scsi/ql/ all zipped... for each individual hosts

    is there a way that this can be done through the ttookit?

    There are currently, as far as I know, no cmdlets in the VITK that allow you to access the local file system of the ESX COS.

    But with the plink.exe and sudo command you can get something that comes close.

    $User = 
    $Pswd = 
    $Computer = 
    $plink = "\plink.exe"
    $plinkoptions = " -v -batch -pw $Pswd"
    $cmd1 = 'sudo -u root cat /etc/vmware/esx.conf'
    
    $remoteCommand = '"' + $cmd1 + '"'
    $command = $plink + " " + $plinkoptions + " " + $User + "@" + $computer + " " + $remoteCommand
    
    $msg = Invoke-Expression -command $command
    $msg | Set-Content "C:\Temp\esx.conf"
    

    In this script, see the esx.conf file and the output is captured and stored in a file on the local file system.

    For the sudo configuration, see my notes in allowing AD authentication

  • Script adding a host to a distributed switch does not

    It's weird and I'm sure it's something simple.  I've created a script that configures the NTP and the syslog on a host computer.  I added on the configuration of the standard vswitch0 and part works fine.  I set the MTU, add a vMotion and port FT and that part works fine. I wanted to add on a section of code to add the host of our distributed switch.  Environment vSphere 5.5 U2, switch is a distributed switch 5.5.  For some reason, the code is not error at all but just does nothing.  However, if I paste the code into a Powershell window it works fine.  Same code, same host, same switch.  Ideas as to why it works manually by pasting the code into a window, but does not work, I use the script itself.  Here's the code that does not work in the script:

    #Adds vmnic5 and vmnic6 for the distributed switch

    Write-Host

    Write-Host «Addition of $VMHost to the switch distributed $vds...» "- ForegroundColor"green ".

    Disconnect-VIServer *-confirm: $false #earlier part of the script is directly connected to the host

    SE connect-VIServer $vcenter | Out-Null #$vcenter variable created earlier in the script

    Get-VDSwitch $vds | Add-VDSwitchVMHost-Server $vcenter - VMhost $VMhost #$vds and $VMhost variables collected earlier in the script

    $vmnic5 = get-VMHost $VMhost | Get-VMHostNetworkAdapter-physics - name vmnic5

    $vmnic6 = get-VMHost $VMhost | Get-VMHostNetworkAdapter-physics - name vmnic6

    Get-VDSwitch $vds | Add-VDSwitchPhysicalNetworkAdapter - VMHostPhysicalNic $vmnic5 - confirm: $false

    Get-VDSwitch $vds | Add-VDSwitchPhysicalNetworkAdapter - VMHostPhysicalNic $vmnic6 - confirm: $false

    Seems pretty simple, but for some reason it just doesn't work.  Any ideas?

    When you load the script into an editor (PowerShell ISE for example) and can run from there, run the cmdlets vDS?

  • Script for the host Cluster Datacenter WWN of output

    Hi all

    I'm looking to create a script to the output:

    WWN with WWP, Datacenter, Cluster, host

    Do not know how to start with this one. I guess I'd start using Get-Data Center and get-content then from there.

    Any help appreciated,

    Rob.

    Rob,

    You can try the following code. It should be a pretty good entry at the very least. I don't have a FC HBA in my lab at home to work out the kinks with the info WWN that will have to wait until tomorrow.

    $vmhosts = get-VMHost

    $HBAInfo = @)

    {Foreach ($vmhost to $vmhosts)

    $HBAs = $vmhost | Get-VMHostHba-type FibreChannel

    $DC = (get-Datacenter - VMHost $vmhost). Name

    $Cluster = (get-Cluster - VMHost $vmhost). Name

    {Foreach ($HBA to $HBAs)

    $Details = "" | Select WWN, Datacenter, Cluster host

    $Details.WWN = $HBA. PortWorldWideName

    $Details.Datacenter = $DC

    $Details.Cluster = $Cluster

    $Details.Host = $vmhost. Name

    $HBAInfo += $Details

    }

    }

    $HBAInfo

  • How to run the powershell script of command with several parameters

    Is there a way to run a powershell script from the dialog box run with several parameters? In addition, the path to the script contains spaces, for example, c:\powershell scripts\script.ps1.

    Take a look at http://www.powershell.nu/2009/12/16/running-scripts-with-arguments-in-powershell/ which explains how to pass arguments to a script.

    André

  • Script to get host version number

    Hey guys,.

    Someone at - it a script that would take all the hosts in vCenter and output of each host name and the current ESX version number to an excel file?

    Thank you.

    Try the following:

    Get-VMHost | Select Name,Version,Build | Export-CSV C:\HostInfo.csv -NoTypeInformation
    

    -

Maybe you are looking for

  • After the update of v.27.0a1 v.28.0a1, he crashes at startup (appcrash)

    HelloAfter update my Firefox nightly from version 27.0a1 to version 28.0a1 the application starts over.I get an APPCRASH error with the following information (unfortunately in German): Problemereignisname: APPCRASH Anwendungsname: firefox.exe Anwendu

  • Satellite L730-A191 - random stop

    I have laptop Satellite L730 - A191 (PSK0CV) that have a stop at random, in safe mode it seems ok, but when it starts in normal mode I experience the problem. When installing the OS is running it will restart all of a sudden that's why no operating s

  • Why is Pocket more than 35 GB?

    I have a lot of music, Yes, currently more than 70,000 songs and 7 000 artists.  This is equivalent to about 450 GB.  But I am trying to reduce congestion and to find more space on my hard drive and was surprised to find iTunes cover is more than 35

  • Definition of deployment model

    Hello I use the latest version of TestStand and many test and deployment in the past, solutions created by using the sequential model. But this time, I use the model of batch, and I can understand not just how to include this setting in the deploymen

  • Windows movie maker-My music will not play

    I had to do a project for school... actually TWO. I've already shot one, but the other is I had edited when I went to change the music would not be the music I just registered so I was going to see what I could do, I played the movie, NOTHING music i