<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Events &#8211; Part 3 : Auditing VM device changes	</title>
	<atom:link href="https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Fri, 11 Jun 2021 21:07:36 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-7564</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 11 Jun 2021 21:07:36 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-7564</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-7551&quot;&gt;Alexander&lt;/a&gt;.

Hi,
Not sure what you mean.
The script retrieves all ReconfigVM_Task tasks, and then per Task, via the EventChainId property retrieves all related events.]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
Not sure what you mean.<br />
The script retrieves all ReconfigVM_Task tasks, and then per Task, via the EventChainId property retrieves all related events.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Alexander		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-7551</link>

		<dc:creator><![CDATA[Alexander]]></dc:creator>
		<pubDate>Thu, 10 Jun 2021 12:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-7551</guid>

					<description><![CDATA[Hello LucD. Thanks for the great script!
I have a question. What do you think, is there a way to query the related event for reconfiguration change task? The thing is, that reconfiguration task has related event wich has a description that tells us what and how was exactly changed. It would be much useful if we could add this description into the exported csv file.
Example:
Reconfigured VM on HOST in Datacenter. Modified: config.hardware.numCoresPerSocket: 2 -&#062; 4; config.hardware.memoryMB: 4096 -&#062; 8192;]]></description>
			<content:encoded><![CDATA[<p>Hello LucD. Thanks for the great script!<br />
I have a question. What do you think, is there a way to query the related event for reconfiguration change task? The thing is, that reconfiguration task has related event wich has a description that tells us what and how was exactly changed. It would be much useful if we could add this description into the exported csv file.<br />
Example:<br />
Reconfigured VM on HOST in Datacenter. Modified: config.hardware.numCoresPerSocket: 2 -&gt; 4; config.hardware.memoryMB: 4096 -&gt; 8192;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Macleud		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-6806</link>

		<dc:creator><![CDATA[Macleud]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 17:17:40 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-6806</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-6804&quot;&gt;LucD&lt;/a&gt;.

It looks like a problem in one the vcenter.
Others the vcenter are fine. 
Thanks!]]></description>
			<content:encoded><![CDATA[<p>It looks like a problem in one the vcenter.<br />
Others the vcenter are fine.<br />
Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-6804</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 14:56:13 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-6804</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-6803&quot;&gt;Macleud&lt;/a&gt;.

Are you sure you are connected to a vCenter?
Were there any errors before the 1st one (CreateCollectorForEvents) you listed here?]]></description>
			<content:encoded><![CDATA[<p>Are you sure you are connected to a vCenter?<br />
Were there any errors before the 1st one (CreateCollectorForEvents) you listed here?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Macleud		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-6803</link>

		<dc:creator><![CDATA[Macleud]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 14:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-6803</guid>

					<description><![CDATA[Hi LucD.
I run the script but the result is no luck.

MethodInvocationException: /Users/mac/Documents/Redirect/TaskVM.ps1:26
Line &#124;
  26 &#124;          $eCollector = Get-View ($eventMgr.CreateCollectorForEvents($e …
     &#124;          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     &#124; Exception calling &quot;CreateCollectorForEvents&quot; with &quot;1&quot; argument(s): &quot;A specified parameter was not correct: &quot;

InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:27
Line &#124;
  27 &#124;          $events = $eCollector.ReadNextEvents($eventnumber)
     &#124;          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     &#124; You cannot call a method on a null-valued expression.

InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:52
Line &#124;
  52 &#124;          $ecollection = $eCollector.ReadNextEvents($eventnumber)
     &#124;          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     &#124; You cannot call a method on a null-valued expression.

InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:54
Line &#124;
  54 &#124;          $eCollector.DestroyCollector()
     &#124;          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     &#124; You cannot call a method on a null-valued expression.]]></description>
			<content:encoded><![CDATA[<p>Hi LucD.<br />
I run the script but the result is no luck.</p>
<p>MethodInvocationException: /Users/mac/Documents/Redirect/TaskVM.ps1:26<br />
Line |<br />
  26 |          $eCollector = Get-View ($eventMgr.CreateCollectorForEvents($e …<br />
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
     | Exception calling &#8220;CreateCollectorForEvents&#8221; with &#8220;1&#8221; argument(s): &#8220;A specified parameter was not correct: &#8221;</p>
<p>InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:27<br />
Line |<br />
  27 |          $events = $eCollector.ReadNextEvents($eventnumber)<br />
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
     | You cannot call a method on a null-valued expression.</p>
<p>InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:52<br />
Line |<br />
  52 |          $ecollection = $eCollector.ReadNextEvents($eventnumber)<br />
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
     | You cannot call a method on a null-valued expression.</p>
<p>InvalidOperation: /Users/mac/Documents/Redirect/TaskVM.ps1:54<br />
Line |<br />
  54 |          $eCollector.DestroyCollector()<br />
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
     | You cannot call a method on a null-valued expression.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-5015</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 09 Sep 2020 15:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-5015</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-5013&quot;&gt;Erwin&lt;/a&gt;.

Instead of calling the Get-VIEvent cmdlet multiple times, you better do something like this.
&lt;code&gt;
$servers=Get-Cluster -name LIM-SANFER &#124; Get-VM

Get-VIEvent -Entity $servers -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddHours(-1) &#124;
where{$_ -is [VMware.Vim.VmReconfiguredEvent] -and $_.ConfigChanges.Modified -match &quot;config.hardware.numCPU&#124;config.hardware.memoryMB&quot;} &#124;
Group-Object -Property {$_.VM.Name} -PipelineVariable group &#124;
ForEach-Object -Process {
        $group.Group &#124; 
        Select @{N=&#039;VM&#039;;E={$group.Name}},
            @{N=&#039;User&#039;;E={$_.UserName}},
            @{N=&#039;Details&#039;;E={$_.FullFormattedMessage}}
}
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>Instead of calling the Get-VIEvent cmdlet multiple times, you better do something like this.<br />
<code><br />
$servers=Get-Cluster -name LIM-SANFER | Get-VM</p>
<p>Get-VIEvent -Entity $servers -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddHours(-1) |<br />
where{$_ -is [VMware.Vim.VmReconfiguredEvent] -and $_.ConfigChanges.Modified -match "config.hardware.numCPU|config.hardware.memoryMB"} |<br />
Group-Object -Property {$_.VM.Name} -PipelineVariable group |<br />
ForEach-Object -Process {<br />
        $group.Group |<br />
        Select @{N='VM';E={$group.Name}},<br />
            @{N='User';E={$_.UserName}},<br />
            @{N='Details';E={$_.FullFormattedMessage}}<br />
}<br />
</code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Erwin		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-5013</link>

		<dc:creator><![CDATA[Erwin]]></dc:creator>
		<pubDate>Wed, 09 Sep 2020 15:25:38 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-5013</guid>

					<description><![CDATA[Hi Lucd,
First of all, thanks for the scripts that make our automation life easier.
I have a query, I want to work with the events of the vm to know which servers were modified in memory and cpu, but I still cannot finish it, it only works with cpu but when I add the memory it no longer works.

$servers=get-cluster -name LIM-SANFER &#124; get-vm
$i=1
$Total=@()
$TotalServer=$servers.Count
foreach($server in $servers){
    Write-Progress -Activity &quot;Getting Info Please wait......&quot; -Status &quot;Server $server ($i/$TotalServer)&quot; -PercentComplete ($i/$TotalServer*100) 
    $event=Get-VIEvent -Entity $server &#124; Where { $_.FullFormattedMessage -like &quot;*config.hardware.numCPU*&quot; }
    $event3=Get-VIEvent -Entity $server &#124; Where { $_.FullFormattedMessage -like &quot;*config.hardware.memoryMB*&quot;}
    $i=$i+1
    if($event){
    $event2=$event &#124; select @{N=&#039;user&#039;;E={$_.UserName}}, @{N=&#039;detalle&#039;;E={$_.FullFormattedMessage}}, @{N=&#039;VM&#039;;E={$server}}
    echo $event2
    $Total+=$event2
    }
    else{
        if($event3){
        $event4=$event3 &#124; select @{N=&#039;user&#039;;E={$_.UserName}}, @{N=&#039;detalle&#039;;E={$_.FullFormattedMessage}}, @{N=&#039;VM&#039;;E={$server}}
        echo $event4
        $Total+=$event4
    }
        else{
        
        }

    }

    }
$Total &#124;Export-Csv ./Output.csv -NoTypeInformation]]></description>
			<content:encoded><![CDATA[<p>Hi Lucd,<br />
First of all, thanks for the scripts that make our automation life easier.<br />
I have a query, I want to work with the events of the vm to know which servers were modified in memory and cpu, but I still cannot finish it, it only works with cpu but when I add the memory it no longer works.</p>
<p>$servers=get-cluster -name LIM-SANFER | get-vm<br />
$i=1<br />
$Total=@()<br />
$TotalServer=$servers.Count<br />
foreach($server in $servers){<br />
    Write-Progress -Activity &#8220;Getting Info Please wait&#8230;&#8230;&#8221; -Status &#8220;Server $server ($i/$TotalServer)&#8221; -PercentComplete ($i/$TotalServer*100)<br />
    $event=Get-VIEvent -Entity $server | Where { $_.FullFormattedMessage -like &#8220;*config.hardware.numCPU*&#8221; }<br />
    $event3=Get-VIEvent -Entity $server | Where { $_.FullFormattedMessage -like &#8220;*config.hardware.memoryMB*&#8221;}<br />
    $i=$i+1<br />
    if($event){<br />
    $event2=$event | select @{N=&#8217;user&#8217;;E={$_.UserName}}, @{N=&#8217;detalle&#8217;;E={$_.FullFormattedMessage}}, @{N=&#8217;VM&#8217;;E={$server}}<br />
    echo $event2<br />
    $Total+=$event2<br />
    }<br />
    else{<br />
        if($event3){<br />
        $event4=$event3 | select @{N=&#8217;user&#8217;;E={$_.UserName}}, @{N=&#8217;detalle&#8217;;E={$_.FullFormattedMessage}}, @{N=&#8217;VM&#8217;;E={$server}}<br />
        echo $event4<br />
        $Total+=$event4<br />
    }<br />
        else{</p>
<p>        }</p>
<p>    }</p>
<p>    }<br />
$Total |Export-Csv ./Output.csv -NoTypeInformation</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Vladimir		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-4888</link>

		<dc:creator><![CDATA[Vladimir]]></dc:creator>
		<pubDate>Mon, 10 Aug 2020 08:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-4888</guid>

					<description><![CDATA[Hello, Luc and thank you for great article, it&#039;s helped me alot. But i have a question. Is it&#039;s possible to retrieve Disk UUID from event if disk was created during such event (&quot;add&quot; - operation)? If disk was edited or removed it is easy, i can just add a line to the script:  UUID = $_.Device.backing.uuid and script will return me disk UUID. But if disk was created during operation i will just receive null result.

I there any way to retrieve UUID of the disk from the event of disk creation. If it&#039;s not possible then may be we cant retrieve some other info which can help us to identify disk that was created?]]></description>
			<content:encoded><![CDATA[<p>Hello, Luc and thank you for great article, it&#8217;s helped me alot. But i have a question. Is it&#8217;s possible to retrieve Disk UUID from event if disk was created during such event (&#8220;add&#8221; &#8211; operation)? If disk was edited or removed it is easy, i can just add a line to the script:  UUID = $_.Device.backing.uuid and script will return me disk UUID. But if disk was created during operation i will just receive null result.</p>
<p>I there any way to retrieve UUID of the disk from the event of disk creation. If it&#8217;s not possible then may be we cant retrieve some other info which can help us to identify disk that was created?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-4868</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Thu, 16 Jul 2020 06:56:35 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-4868</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-4867&quot;&gt;decniner&lt;/a&gt;.

Hi,
No, there is nothing missing.
When there is no value for any of these present in the event, their value was not changed.
Hence the empty string.]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
No, there is nothing missing.<br />
When there is no value for any of these present in the event, their value was not changed.<br />
Hence the empty string.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: decniner		</title>
		<link>https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-4867</link>

		<dc:creator><![CDATA[decniner]]></dc:creator>
		<pubDate>Thu, 16 Jul 2020 05:59:08 +0000</pubDate>
		<guid isPermaLink="false">http://lucd.info/?p=1237#comment-4867</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2009/12/18/events-part-3-auditing-vm-device-changes/#comment-3517&quot;&gt;Nathan Kulas&lt;/a&gt;.

It looks like there are some information missing from below line.  Can you share what are those?

Memory = else{“”}}
NumCPU = else{“”}}
Disk = else{“”}}]]></description>
			<content:encoded><![CDATA[<p>It looks like there are some information missing from below line.  Can you share what are those?</p>
<p>Memory = else{“”}}<br />
NumCPU = else{“”}}<br />
Disk = else{“”}}</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
