Script to read Date stamp of VMDK

Hi all!  I started using the script from Alan Renouf to date stamp & info on our virtual machines (http://www.virtu-al.net/2010/02/23/who-created-that-vm/).  It works fine; but of course it's limited to the data stored in the CR.  Because our data expires after 90 days - he gave me a lot for the MUCH older VMs.

Made me think of locations other than info could be and I thought of the idea of the original VMDK file on the data store.  The first VMDK (in most, if not all, cases) seems to have the original timestamp of this file and does not seem to have changed, as the other files in the VM folder on the data store.

So is it possible read the xxx time stamp. VMDK to each virtual machine in all data warehouses and send date/time to the script from Alan?

I changed Alan Renouf script "that created this virtual machine?" to try to get the date of creation of Active Directory, if it is not found in the events:

Connect-VIServer MYVISERVER
# Uncomment the next line to test this script and tell you what it would do !
# $WhatIfPreference = $true
if (-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue)) {
    Add-PSSnapin VMware.VimAutomation.Core
}
if (-not (Get-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue)) {
    Add-PSSnapin Quest.ActiveRoles.ADManagement
}

$VMs = Get-VM | Sort Name
$VM = $VMs | Select -First 1
If (-not $vm.CustomFields.ContainsKey("CreatedBy")) {
    Write-Host "Creating CreatedBy Custom field for all VM's"
    New-CustomAttribute -TargetType VirtualMachine -Name CreatedBy | Out-Null
}
If (-not $vm.CustomFields.ContainsKey("CreatedOn")) {
    Write-Host "Creating CreatedOn Custom field for all VM's"
    New-CustomAttribute -TargetType VirtualMachine -Name CreatedOn | Out-Null
}
Foreach ($VM in $VMs){
    If ($vm.CustomFields["CreatedBy"] -eq $null -or $vm.CustomFields["CreatedBy"] -eq ""){
        Write-Host "Finding creator for $vm"
        $Event = $VM | Get-VIEvent -Types Info -MaxSamples 99999999 | Where { $_.Gettype().Name -eq "VmBeingDeployedEvent" -or $_.Gettype().Name -eq "VmCreatedEvent" -or $_.Gettype().Name -eq "VmRegisteredEvent" -or $_.Gettype().Name -eq "VmClonedEvent"}
        If (($Event | Measure-Object).Count -eq 0){
            $User = "Unknown"
            $Computer = Get-QADComputer -Identity $VM.Name
            if ($Computer) {
              $Created = $Computer.WhenCreated.ToString()
            }
            else {
              $Created = "Unknown"
            }
        } Else {
            If ($Event.Username -eq "" -or $Event.Username -eq $null) {
                $User = "Unknown"
            } Else {
                $User = (Get-QADUser -Identity $Event.Username).DisplayName
                if ($User -eq $null -or $User -eq ""){
                    $User = $Event.Username
                }
                $Created = $Event.CreatedTime
            }
        }
        Write "Adding info to $($VM.Name)"
        Write-Host -ForegroundColor Yellow "CreatedBy $User"
        $VM | Set-CustomField -Name "CreatedBy" -Value $User | Out-Null
        Write-Host -ForegroundColor Yellow "CreatedOn $Created"
        $VM | Set-CustomField -Name "CreatedOn" -Value $Created | Out-Null
    }
}

Best regards, Robert

Adding the parameter - MaxSamples for the Get-VIEvent cmdlet.

Post edited by: RvdNieuwendijk

Tags: VMware

Similar Questions

  • Reading data from a text (JS CS3) file tabs-delimited

    Hi - I'm working on a script to read data from a text file and use in a dialog box. But I hit a wall.

    I used a script from a previous post that defines a variable text document when the user script he chooses from a drop-down list.

    var myDialog = app.dialogs.add({name:"Map",canCancel:true});)
    {with (MyDialog)}

    {with (dialogColumns.Add ())}
    {with (borderPanels.Add ())}
    staticTexts.add ({staticLabel: "choose the location :"});})
    {with (dialogColumns.Add ())}

    var file = File("~/Desktop/myPlacesfile.txt");

    leader. Open ("r");
    var str = file.read ();
    leader. Close();
    var myPlaceList = str.split (/ [\r\n] + /);
    var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
    }
    }}}
    Ditto var = myDialog.show ();
    if(myResult == true) {}
    If (myPlaceMenu.selectedIndex == 0) {}
    myPlace var = ' - undefined ";
    } else {}
    myPlace var = myPlaceList [myPlaceMenu.selectedIndex];
    Alert (myPlace);
    }

    myDialog.destroy ();
    }

    That's what I do now:

    The text file is in this format:

    Value1 value2 [TAB]

    Value1 value2 [TAB]

    Value1 value2 [TAB]

    I need to have the drop down dialog box show only the value 1, and after that the user selects, the script returns only the value 2. (The alert is just there to test - I'm doing something else with the variable).

    Is there a way to view the first part of a tab-delimited line in the menu drop down and return the second half as a variable?

    Any help would be greatly appreciated.

    Thank you

    One of the possibilities is that it. Create a table to the left of the values of the tab of the dialog box. Then create an object that you use it as a table of correspondence. Roughly as follows:

    same thing as what you have

    leader. Open ("r");
    var str = file.read ();
    leader. Close();
    var array = str.split (/ [\r\n] + /);

    'pairs' are the table of correspondence

    pair of var = {};

    as before, 'myPlaceList' will be used for the menu drop-down
    var myPlaceList = [];

    var v;
    for (var i = 0; i)< array.length;="">
    {
    v = table [i] .split ('\t');
    pairs [v [0]] = v [1];
    myPlaceList.push (v [0]);
    }

    Add the drop-down list as before:

    var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})

    the table of 'pairs' correspondence is used as follows: pairs ['value1'] returns 'value2 '.

    so in your script that would be:

    myPlace var pairs = [myPlaceList [myPlaceMenu.selectedIndex]];

    Peter

  • Dynamic date stamp along the page border

    I have a javascript to put a stamp on dynamic date vertically along the left edge of a PDF document.  This script works very well for the first page.  However, on a document of several pages, that the date stamp is not turned 90 degrees, so on the 2nd page, there are just a few letters horizontally.  Here's the script.

    var inches = 72;

    for (variety p = 0; p < this.numPages; p ++) {}

    / / create rectangle to field quads

    aRect var = this.getPageBox ({nPage: p});

    aRect [0] = 0.0;

    aRect [1] = 0.0;

    aRect [2] = 26.0;

    aRect [3] = 792;

    / / now to build text field to fill with date information

    var f = this.addField ("PrintField", "text", p, aRect)

    f.delay = true;

    f.rotation = 90;

    f.textSize = 16;

    f.textFont = fonts. HelvB;

    f.textColor = color.black;

    f.alignment = 'center ';

    f.readonly = true;

    f.print = true;

    f.hidden = true;

    f.delay = false;

    }

    Adds a script level doc to fill out the text field when doc prints from

    Acrobat or Adobe Reader free. Note: the character '\r' represents a

    carriage return.

    var myWillPrintScript = ' var f = this.getField("PrintField"); \r' + ' f.hidden = false; \r' + ' var d = new Date(); \r' + ' year var = d.getYear () + 1900; \r' + ' var minutes = d.getMinutes (); \r' + ' if (mn < 10) {\r' + ' min = "0" + min}; \r' + ' if (d.getHours () > = 12) {\r' + ' mins = minutes + "H"; \r' + '} else {\r' + ' mins = minutes + 'AM' ;} \r' + ' f.value = 'CE DOCUMENT ONLY EFFECTIVE ON' + (d.getMonth () + 1) + "/" + d.getDate () + ' / ' + year;} \r'

    var myDidPrintScript = ' var f = this.getField("PrintField"); \r'

                               + ' f.value = ""; \r'

                               + ' f.hidden = true; \r'

    Now define scripts to run on the will / did print events.

    this.setAction ("WillPrint", myWillPrintScript);

    this.setAction ("DidPrint", myDidPrintScript);

    FYI: This script came from the following options other threads and links

    http://www.PlanetPDF.com/developer/article.asp?contentid=AddingdynamicstampstoPDFswhenprin ting

    http://forums.Adobe.com/thread/286289

    http://forums.Adobe.com/message/1097488#1097488

    Can someone understand why this script does not work on all pages?

    Thank you

    This is a bug in Adobe Acrobat. Add the following code after your loop for:

    for (variety p = 0; p)< this.numpages;="" p++)="">

    var f = this.getField ("PrintField." + p);

    f.Rotation = 90;
    }

  • Reading data external pc

    Hi guys, I'm kinda new to the instruments OR, and I need to understand how to read data from a PXI-1042 q, which has a PXI-8187 embedded controller and an array of the PXI-4472. I need to read the data to an external computer via one of the serial ports on PXI-8187, using a python House program. I found something on how to send and retrieve data from a serial port using pyVisa, I still don't know how to communicate with the PXI-8187 and select the appropriate entry in the PXI-4472. I need to create a custom PXI-8187 VI do listen to the entries via serial and send output to the same port? Any suggestion will be appreciated.

    Thanks in advance!

    DocShadow wrote:

    do I still need create a VI for the PXI-8187 with my computer via the LAN interface?

    Yes.  The controller is another computer.  Treat it as one.  This computer must interface with the PXI instruments.  Your computer you write Python scripts for has no interaction except through any interface that you create, both in series or LAN (I recommend using both the LAN).

  • read data dynamically in a txt document

    I try to dynamically read data a txt document

    in swf

    Stop ();

    var pafh = this;

    import flash.events. *;

    var Araray_id:Array = new Array();

    var v_length:Number;

    var myTextLoader:URLLoader = new URLLoader();

    myTextLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

    myTextLoader.addEventListener (Event.COMPLETE, onLoaded);

    function onLoaded(e:Event):void {}

    Araray_id = e.target.data.araray_id.split(",");

    trace ("Araray_id:" + Araray_id);

    V_LENGTH = Araray_id. Length;

    trace ("v_length:" + v_length);

    for (var i: Number = 0; i < v_length; i ++) {}

    pafh ["Id_" + i] = new Array();

    trace ("pafh [Id_ + i]:" + pafh ["Id_" + i]);

    var v_help:Object = "id_" + i;

    trace ("v_help:" + v_help);

    pafh ["Id_" + i] = e.target.data.v_help.split(",");? Stops the script here

    pafh ["Id_" + i] = e.target.data. (v_help).split(",");? Stops the script here

    pafh ["Id_" + i] = e.target.data. [v_help].split(",");? Stops the script here

    }

    Play();

    }

    myTextLoader.load (new URLRequest ("myText1.txt"));

    -------------------------------------------------------

    in the text

    araray_id = aa, bb, cc, dd, ee, ff

    & id_0 = aa1, aa2, aa3 and aa4

    & id_1 = bb1, bb2, bb3, bb4, bb5

    & id_2 = cc1, cc2, cc3

    & id_3 = dd1 dd2 dd3, dd4, dd5, dd6

    & id_4 = ee1, ee2

    & id_5 = ff1, ff2

    -------------------------------------------------------

    output

    Araray_id: aa, bb, cc, dd, ee, ff

    V_LENGTH: 6

    pafh [Id_ + i]:

    v_help: id_0

    TypeError: Error #1010: a term is undefined and has no properties.

    at skuskaceatarraybiforas3fromtext_fla::MainTimeline/onLoaded()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at flash.net::URLLoader/onComplete()

    You can help me with this problem

    You had those Ines great comment so I did not like being in that you ran to get this error.

    Try...

    pafh ["Id_" + i] = e.target.data [v_help].split(",");

    (Note the point deleted after data)

    and create v_help as a string, not an object

  • How to create personalized with a dynamic date stamps

    I tried to create a customized with a dynamic date stamp. But the date is not dynamic. Help, please

    There are a number of things that need to be properly configured for a stamp to work as a dynamic stamp, form the name of template to the calculation script. If you provide the details of how you set the PDF stamp, it would be useful, as would the next book that has all the information you need: www.amazon.com/About-Stamps-Acrobat® - without paper-Workflows/dp/0985614706 /.

  • Add 90 s date 'creation date' stamp on photos

    Hello

    I'm about to order a photobook (Christmas gift for some parents). The book has nearly 300 photos in there,

    The pictures need to have dates. I could add a date manually for each photo, but I don't really have the time to.

    All the photos have exif data correct, with creation date information. Anyone know how I can just destructivly stamp

    This on the photo itself? Bit of a weird problem, I don't think that bridge/ch can do with its default value

    features - but I know I've seen that somewhere some time in some software products featured!

    And yes I know date stamps look terrible, but most of the family photos aren't exactly fine arts first: >

    Advice appreciated, it would be a huge timesaver for me!

    It can be done with a Photoshop Script that adda a usinf text layer the date in the EXIF data. An example is my stampexif script. It adds a layer of text that can be used in an action, then the added text layer can be positioned and the title of the action. The script would be easy to modify and format the content of text to your likeing.

    Link to the http://www.mouseprints.net/old/dpr/StampExif.jsx script

  • Certificate of completion with Date stamp

    Greetings,

    Is it possible to make a form that will automatically add a stamp to date. ? Here's the scenario: a user makes a series of questions through an e-learning module. The end of it, they click a button/link that leads to a page that contains a PDF file. The PDF file has a form to fill out so they enter their name in it and at some point, maybe when they get to the pdp, it's time/date stamp for this user. They print the PDF and give it to their supervisor.

    Make sense?

    Maybe it's not possible to get the stamp to be added as soon as they arrive to the PDF, maybe they have to press a button on the PDF of it be added? I don't know what is possible or if it is possible. We would like just to have a way to get a stamp on the PDF document. The PDF file must not be downloaded, there need be printed in paper format, although having an option to have the PDF sent by email to the user may be an option as long as it can only be printed.

    Comments, suggestions?

    Yes, it is possible, with a bit of JavaScript. You can have the date field automatically filled when the form is first opened or after they enter their name. For the latter, you can add the following script to the name field Validate event:

    // Get a reference to the date field
    var f = getField("date");
    
    if (event.value) {
        f.value = util.printd("mm/dd/yyyy", new Date());
    } else {
        f.value = "";
    }
    

    Replace "date" with the actual name of your date field. You can also use a different date format, but this should help you get started. If you fill out when the document is opened, it's a little more complicated, but post again if this is what you want.

  • My JournE Touch tablet is not read data on USB

    Hello!

    When I plug my USB stick with games and open it I see nothing, as the Tablet is not read data on usb.
    Can someone help me?

    Guide me a bit.

    Journ.E touch manages and supports SDHC up to 32GB.
    Supported file formats are:

    * Image * JPEG file format
    * Audio * file - MP3, WMA, AAC and WAV format
    * Video * format of file - AVI, MP4, 3GP, FLV and WMV

    Other file formats are not supported.

  • Equium A200-1V0: DVD-RAM UJ-850 s does not read data discs

    My laptop seems to have decided to stop reading data disks.
    However, there is no problem with the audio CD, but when I insert a data disc such as the software considers the disk is empty and try to format the drive.
    I searched internet day for solutions and tried without success to the following:

    Removed the UpperFilters and LowerFilters in the registry.
    Uninstalled and reinstalled drivers.
    Bought DriverWhiz (waste of money!)
    Tried to access disc command prompt that generated the message "incorrect function".
    Tried to use the enforcement function and access an exe file that I know is on the disk, but it comes up saying I need to format the drive
    Uninstall service packs
    I even thought it might be something to do with the MagicVirtual drive I had installed so I uninstalled completely which
    I uninstalled real player

    I'm about 3 minutes to destroy my laptop so any help would be appreciated.

    Laptop: Equium A200 - 1V0
    Drive DVD - RW: MAST * a DVD-RAM UJ-850 s ATA
    OS: Windows Vista

    Hello

    Deleting upper and lower filters was the first idea that I'd like to share with you, but it seems that you have already tried this solution proposal

    How about windows boot CD or a linux live CD?
    Is this possible?

    If not then I thing that the question could be linked to the wrong material work I m thinking on the issue of laser lenses eventually the laser lens can not calibrate properly and this could be a problem

    In this case, only a replacement CD/DVD drive can help greet

  • "Could not read data" when you try to print from Android

    Hello. I have a printer HP Officejet 6700 Premium, which is connected via ePrint/HP connected to my Google account so that I can print from my Google devices (Cloud Print). While this works very well when printing from my laptop (29 Chrome on Ubuntu 13.04), it does not when printing my Nexus 10 (Android 4.3) or my Galaxy Nexus (CyanogenMod 10.1.3). I tried printing both outside and inside the network on which the printer is on, but whenever I get "could not read data" in the Cloud Print dialog box. It seems that Cloud Print knows that the printer exists, since it is on the list, but it cannot communicate with the printer. Any way to solve this problem? He's good enough additional features only on my previous printer, who died of old age.

    It seems to me that the question is in fact Cloud Print related. Here is the support page: https://support.google.com/cloudprint/?rd=1

    Remember that Google Cloud Print is still in beta phase. Good luck tomslominski.

  • HP Pavilion X 2: HP Pavilion XP cannot read data from USB DVDs

    We bought a HP 10-ND200ND (HP pavilion X 2) in the Mediamarkt and tried to install Microsoft Office from a DVD via a DVD USB Samsung player.  This was not possible. According to Support Mediamarkt this product is a Tablet and so cannot read data DVD´s. Only General to play music. To buy a laptop computer for this application. The operating system is Windows 10 (32 bit). Is that correct. Please advice.

    Hi Banhien, the cause is known. I have seen other comments on the HP forum and concluded that the reader needs more power than is available through the USB connector of. I added a hub that can provide power to its connectors USB, HP X 2, by car and the problem has been resolved! It was noted that the mini USB is also more powerful and with the type of adapter USB USB C it might also work, but I did not test this, because I do not have such an adapter. It's odd that such a mini can provide more power. It is surprising that the HP Pavilion X 2 does not have a powerful USB. But the problem is solved. Thanks for your response! Best regards, wiely

  • Satellite L30-134 PSL33E: CD/DVD player can't read data CD

    I bought my laptop (Satellite L30-134 PSL33E) 4 months ago and I had no problem with the optical drive of my Satellite. But yesterday, I discovered that my drive is no longer can read data CDs.

    I created a CD with the Toshiba ToDisc utility which contained MP3s. The CD works fine on another computer but when I try to play them on this computer Windows laptop tells me that the CD is blank and asks me if I want to save data.

    It doesn't have this problem with the DVD, I can read and write perfectly. My optical drive is a CARPET * a DVD-RAM UJ - 841S. Windows says I have the latest driver for it (5.1.2535.0) but it says it's from 2001 (?) in the properties under the selected hardware.

    Help, please!

    Hello

    It is not easy to say what the problem is here. If you have time please check THIS document.

    Support Bulletin 98081245 CD burning: suggestions and troubleshooting. ‘

  • nvstor64 error - failure of HARD drive to read data

    Backup and restore system is unable to complete - after investigation, about an hour after the backup operation to the system event log records a large number of errors in nvstor64 - "failed to read data from the HARD drive" and the abandonment of the backup operation.  After investigation, I found that the nvstor64 replaced the windows driver update disk drivers HARD during a computer video card.  After many contacts with support from nvidia and further consideration, the problem is reduced to the State of the offence alleged in the second hard drive backup (Seagate 1 TB Baraccuda - development since 2/2011).  When you run the HP disk HARD diagnosis on this drive, it does not hard "SMART short self-test" step with the error message "fails first LBA 45511183".

    Here's my question.  Run the chkdsk BACK on this disc utility passes - no bad sectors.   The HARD drive is visible in the operating system and appears to be fully accessible.  I moved 100 GB of files from the disc to others in the network with no apparent problems.  This really works test by the "SMART short self-test?  This is a 'false positive' test failed?

    Paul

    Pavilion p6210f

    Windows 7 64 bit

    6 GB of system memory

    C: WD 1 TB 7200 RPM HARD DRIVE

    F: drive HARD Seagate 1 TB 7200 RPM

    Hello smithdp,

    The SMART test tests in-depth hard disk. Here's the Wikipedia record for the short trial (they can explain better than me).
    http://goo.GL/XYCvm.
    Short
    Check electrical and mechanical performance as well as the disk read performance. Electric tests could include a test of memory buffer RAM, a read/write circuits test or a test of the read/write head elements. Mechanical test includes seeking and servo on the data track. Scans small parts of the drive surface (area is provider-specific and there is a time limit on the test). Checks the list of areas that may be read errors in waiting. (Usually less than two minutes.)

    Having said that it is not perfect, because no test is, it could be bad, or it could be on-site. Sometimes the SMART test can give a warning, but the drive will not fail for another month + is just a 'heads up '.

    Now, with your error in particular LBA is logical block address. The error you are getting is that there is a block (45511183) that the test has detected an error on.

  • CAN read data using NI-XNET

    I was playing around with the new NI XNET drivers read CAN data and I need some experts advise on this topic. In the frame API, I remember to be able to check that if there is data on the queue of read before reading, with Xnet, I have not found this option. XNET use playback function that will read the entire queue without worrying if the data is present.

    This causes me a problem, because I'm constantly calling loop playback function, the data are written to a table of images, then the table will be empty for the next iteration because the reading queue was empty during the second reading.

    How can I continually read data from the queue of reading without accidental my output table?

    I tried the survey/Deque method, but it works well for me. Is someone can you please tell me what is the best practice for continuously reading the CAN data and treatment using drivers XNET?

    Thank you

    Sam

    Looks like you want to use with your berries shift registers. Discover this Subvi, which is part of the expedition OR XNET examples. You can find examples from the Finder example under help > find examples.

    Apart from converting it the image into a string, the additions loop the string to an array and use the shift registers to pass the array in the iterations of the loop.

    Is that what you're looking for?

Maybe you are looking for

  • How can I get rid of "antivirus XP 2008"?

    I have a computer dell laptop with XP. There is a program called "antivirus XP 2008".  It has an option of uninstall, but when I try to uninstall the program uninstallation fails. Can someone help with this problem?

  • Received a call this morning saying that my computer has sent an error message indicating that my computer was likely to crash

    Original title: is it a scam I recently bought a laptop and after using it about a month, I received a call from someone who said they were with the technical support of windows and my computer has sent a msg of error indicated that my computer was v

  • Using Windows Vista, cannot find images

    I'm using Windows Vista and I am unable to find a few pictures that I know have not been deleted. Is it possible that they have been archived in some way, and if so how can I recover them?

  • Problem with KB28083821 and KB2855336 updates

    When Microsoft will challenge updates KB28083821 and KB2855336 so that they will not install on Windows 8. Have you tried many times to install and have failed since the first day on two different machines? In addition, Microsoft FIXIT is never avail

  • Muse to create 54 separate css files?

    Newbie question, but after the download of a muse in British Colombia for the test site when I look at the page to develop British Colombia, there are 54 css files. Each page has its own style sheets? No idea why Muse would exit 54 css files when all