Advice on the combination of scripts in a

Hi all

I have two scripts, when the script runs, it calls script B. I would like to add script A script B. Here's how the script calls script b:

(This is part of the Script that calls the script B (.\Join-Collections.ps1))

#Start in A Script

#Import has merged the two csv files into variables and export file

$csv1 = Import-Csv LunUUIDtoDS.csv -UseCulture

$csv2 = Import-Csv VMtoDS.csv -UseCulture

#Call script ' Join - Collections.ps1 to merge the two files

.\Join-Collections.ps1 $csv1 'DS' $csv2 | Export-Csv mergedCSV.csv NoTypeInformation - -UseCulture

#End in A Script

Join #The collections script in another file:

#Script B:

##############################
#Collect objects from csv files

(PARAM
$FirstCollection
[string] $FirstJoinColumn
$SecondCollection
[string] $SecondJoinColumn = $FirstJoinColumn
)
{IN PROCESS
$ErrorActionPreference = "inquire".
{foreach ($first to $FirstCollection)
$SecondCollection | Where {$_.} "" $SecondJoinColumn "-eq $first. {"" $FirstJoinColumn "} | Object-join $first
}
}
Objects #Join
BEGIN {}
function {object Join
(Param
[Parameter (Position = 0)]
$First
,
[Parameter (ValueFromPipeline = $true)]
$Second
)
BEGIN {}
[string []] $p1 = $First | GM-type properties. Select - expand name
}
{In process
$Output = $First | Select $p1
foreach ($p in $Second: gm-type properties |) Where {$p1 - notcontains $_.} Name} | Select - expand name) {}
Add-Member-$Output - type NoteProperty-name $p - value $Second. » $p »
}
$Output
}
}
}
##################################################################################################
THE SCRIPT #END
##################################################################################################

It should look like this

function Join-Collections {
  PARAM(
    $FirstCollection    , [string]$FirstJoinColumn    , $SecondCollection    , [string]$SecondJoinColumn = $FirstJoinColumn  )
  PROCESS {
    $ErrorActionPreference = "Inquire"    foreach($first in $FirstCollection) {
      $SecondCollection | Where{ $_."$SecondJoinColumn" -eq $first."$FirstJoinColumn" } | Join-Object $first    }
  }
  #Join objects
  BEGIN {
    function Join-Object {
      Param(
        [Parameter(Position=0)]
        $First        ,        [Parameter(ValueFromPipeline=$true)]
        $Second      )
      BEGIN {
        [string[]] $p1 = $First | gm -type Properties | select -expand Name      }
      Process {
        $Output = $First | Select $p1        foreach($p in $Second | gm -type Properties | Where { $p1 -notcontains $_.Name } | select -expand Name) {
          Add-Member -in $Output -type NoteProperty -name $p -value $Second."$p"        }
        $Output      }
    }
  }
}

#Import both csv files into variables and export merged file
$csv1 = Import-Csv LunUUIDtoDS.csv -UseCulture $csv2 = Import-Csv VMtoDS.csv -UseCulture 

#Call function Join-Collections to merge both files
Join-Collections $csv1 "DS" $csv2 |
Export-Csv mergedCSV.csv -NoTypeInformation -UseCulture

Tags: VMware

Similar Questions

  • Combine the output of Script of ESX, VM, network, storage, and output in Excel

    Hello

    I have 6 scripts (written by Luke and Robert) who are used to extract information of the box of ESX as shown below. I want to combine the scripts into a single and output in excel. I have a csv file with names of servers esx in it. The combined script should take the entry of the name of the csv esx server and run these scripts and export information to an excel spreadsheet. I need a workbook with each server esx excel as a table in it.

    ESX - report.ps1-> extract info from esx host

    VM - report.ps1-> extract info VM

    Teddy - report.ps1-> extract info ESX physical network adapter

    PortGroup - report.ps1-> extract portgroup info

    scsiHBA - report.ps1-> extract info SCSI & HBA

    Report.ps1-> info report data store retrieves data store

    Firewall - report.ps1-> need to be written (gave joint excel spreadsheet format)

    Time servers - report.ps1-> need to be written (gave joint excel spreadsheet format)

    DNSserver - report.ps1-> need to be written (gave joint excel spreadsheet format)

    I have attached the format of the expected output excel workbook and scripts.

    Thanks in advance!

    There was a bug in the script, the Get-View in the teddy bear (report 3) and the portgroup (report 4) not took into account that the mode of VIServer ran in "multi".

    Which should be fixed in the new version attached.

    The new version also includes the name of ESX for the reports, 7, 8 and 9.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Need some advice on the best way to do specialized source distribution

    I need to give a customer a labview block, they can use our material in their own labview code that will read the (encrypted) data net senor off the coast and the flow of data in a form usable output.  I built a vi that can be used in a loop, a bit similar to the block of canned labview data acquisition that can be used to acquire data from products OR.

    There are many sophisticated (and secret) algorithms going on in the background which make sense data and translate them into a usable data table, but also configure the hardware itself. Accordingly the only final vi I prepared to distribute the client makes use of Subvi about 20. Almost none of these subvis could be ideally be reconverted in plain code in main vi, nor what I want to do this.

    The rules of the game is the following: I want to give him the block I created to use its own code, without him to see what's happening inside the vi.  I can deny him access to the block diagram/s, no problem, but I don't want to give him access to the subvis, to use, or even to know their names - preference they would be hidden or otherwise pre-compiled. Preferably I would just give him the main block only, perhaps with some support files that would be entirely opaque to him.

    Looking for advice on the best way to go. There is an elegant solution to this problem? For example, it would be better to compile the block as a .dll file, and then write a wrapper vi any?

    Have you thought of creating a packed library? You can also password protect your code. You can delete the distributed code block diagrams. You can use a combination of the above as well.

  • Change the text using script

    I am new to scripting and still so much to learn to please bear with me. I worked on a script that will allow me to update the information of slug on the files I work with on a daily basis. I use a combination of scripting and actions on my documents that clean the documents, but aussient to fill specific information for each document. As I learn more about scripts, I could consolidate my scripts and actions.

    Currently, I am working on the selection of specific text frames based on what their note value is using this code:

    var textFrames = activeDocument.textFrames;
    
          for (var i = 0 ; i < textFrames.length; i++)
            if (textFrames[i].note == "JOBNAME") {
              var frameName = textFrames[i].contents = "JOBNAME";
        }
    
    

    Here is a small list of items I would change

    Screen Shot 2013-09-06 at 11.33.07 AM.png

    I can go about it the wrong way, but my ultimate goal is to run a script that runs through each text field, and a dialog box allows me to enter text, then it is replaced by what is entered in the field of dialogue.

    It may be easier to create a dialog box that has all the fields and allows me to enter the value for each of them, but as I said, I'm new to scripting and don't know how to do this.

    I tried to enter my slug information using variable data, with spreadsheets, but I need to convert the xml spreadsheet and I have a lot of luck with that. I found that the use of variables in illustrator can be a little tricky.

    In the end, just trying to simplify my work and make things more efficient. In the process, I would like to know as much about the scripts as I can.

    Thank you

    This should help you get started with the change of name based on the note, with the help of guests

    var textFrames = activeDocument.textFrames;
    
    for (var i = 0 ; i < textFrames.length; i++) {
        if (textFrames[i].note == "JOBNAME") {
            var jobname = prompt ("Enter JOB NAME", "Your Name", "Note Changer");
            textFrames[i].contents = jobname;
        }
    }
    
  • Try to install the latest version of Flash for Firefox on Windows XP, get the Internet Explorer Script error

    I am trying to install the latest version of Flash (file install_flashplayer11x32_mssd_aih.exe), browser = Firefox 14 (current), OS = Windows XP.  I tried several times, making sure to disable Norton Antivirus Autoprotect first.

    At some point throughout the process - while downloading or during Assembly - I get the following error message:

    Internet Explorer Script error

    Line: 1

    Char: 10010

    Error: 'ActionLaunchAdobe' is not defined

    Code: 0

    URL: http://127.0.0.1:1174/app/_js/adobe.js

    Do you want to continue running scripts on this page? [Yes] [None]

    If I answer [Yes] or [no] the result is the same - the program crashes. It does not close, and when I close it manually it asks if I want to stop it. But if I leave it there, nothing happens.

    By the advice of the site, I uninstalled Flash in order to restart costs. This means that, instead of having an outdated Flash version, I now none.

    I tried to RTFM, but research for this error go empty.  I'm curious to know why Internet Explorer being participates in it at first. But mostly, I'm just curious as to how to get this thing to work.

    Thanks for you help with anything that can give me.

    Dave

    @nickzinck - please try to install by using the appropriate Setup program located here:

    http://helpx.Adobe.com/content/help/en/Flash-Player/KB/installation-problems-Flash-Player-Windows.html #main - pars_header

  • Tips for the custom transformation script change the Associations of FK table

    Hello

    I try to write a transformation script that will scroll through tables in a large model and change some
    FK associations to change the remote table at CF. By the way, the reason is that our logic model
    the logical entities that represent many areas of codes of small research. However, our relational and physical model has a
    utility single physical filing table of codes that contains all areas of these codes. Therefore, a part of the transformation
    our logic model for the relational model is to swing all FK associations for these areas of research codes
    in the table of common code. Then the paintings representing the research areas can be removed from hard.

    In any case, I'm looking at the

    oracle.dbtools.crest.model.design.relational.FKIndexAssociation

    or the

    oracle.dbtools.crest.model.design.relational.Index

    to see if one of them can be manipulated to perform the transformation I want to accomplish.

    When I perform the equivalent process manually via the property sheets there are several ways to address this problem.

    (a) the method more jolise seems to change the FK in place by clicking on the FK in the relational schema and changing
    the property called ' PK / UK Index'. Change that to the pharmacokinetics of utility code repository table that replaces the original
    table (which represents the research field). A side effect of this translates into CF mapping
    columns being nulled out. They must be remapped to original columns (which are kept).
    So in two stages, the existing FK is detached from the original, attached table to the new table, and then
    FK columns are reused in place for new CF mapping.

    (b) the brute force method is to remove the original FK and then create a completely new FK to the new table. There are
    several dialog boxes that allow you to keep the original FK columns and use them in the new FK.

    I realize, this is a somewhat complex transformation, but I would like a few algorithmic advice on which path to take
    to try to achieve. In particular, there is a script that is equivalent to that of the first process above?

    I don't even know if the CF which is represented on the relational schema is represented by the FKIndexAssociation or Index
    class in the script object model. In other words, I have to loop through the tables in the relational model what would be my
    starting point:

    FKS = table.getFKAssociationsList ();

    or

    fkIndexes = table.getAllInds_FKeyInds ();

    or something else. The names of the properties in the user interface are always with the properties of scripts not so
    It's a little difficult to understand such things.

    Once I have access to the object that is equivalent to the FK in the property/diagram worksheet, which
    is the best way to handle via script. How can I change the end of parent and away from CF to point to the new table.
    Or if I have to delete the original CF and then re-create - is there a way to save the original FK columns and reuse them
    While creating the new FK?

    ********************

    Another question. What is the best way to remove tables from a relational model. I note that there is a remove() undocumented (?)
    a method that is available on the Table. It's probably a superclass to remove other things as well.

    When I try to use this method in a loop the script throws up to dialog boxes that are similar to dialog boxes that are displayed during the execution of a removal
    manually through the user interface. Is it possible to intercept and answer dialogs programmatically?
    So for example if I get a window of dialogue as

    You want to remove generated columns of FK 'FOO' in the table 'BAR '?

    is it possible to intercept this dialog in the script and then answer Yes or no it via the script?

    ***************

    If it is too difficult to perform this type of transformation with the help of script
    is to do the transformation on the generated DDL file. But it would be cleaner to
    to do the transformation in the relational model DM if possible.

    All advice appreciated.

    Rgds, BP

    When I try to use this method in a loop the script throws up to dialog boxes that are similar to dialog boxes that are displayed during the execution of a removal
    manually through the user interface. Is it possible to intercept and answer dialogs programmatically?
    So for example if I get a window of dialogue as

    You want to remove generated columns of FK 'FOO' in the table 'BAR '?

    is it possible to intercept this dialog in the script and then answer Yes or no it via the script?

    It's in the preferences - "Data Modeler > model > relational > remove FK column strategy."

    I don't even know if the CF which is represented on the relational schema is represented by the FKIndexAssociation or Index

    Is a pair of two - FKIndexAssociation, that's what you see the pattern, but it is hidden in the table index - isFK() returns true for this type of index and you can take FK with getFKAssociation()

    Once access to the object that is equivalent to the CF in the property/diagram worksheet

    table.getFKAssociations () - returns an array of the foreign keys;
    You can get to them from the relational model:
    model.getFKIndexAssociationSet () .toArray () - FK all model

    How can I change the end of parent and away from CF to point to the new table.
    Or if I have to delete the original CF and then re-create - is there a way to save the original FK columns and reuse them
    While creating the new FK?

    There should be no problem if you use the same number of columns with the same data type and order:

    get the current FK columns
    columns = fk.getColumns ();
    newRefKey is the new key question; referred and child columns must match the data type and the order in the keys - you do not ask how to get
    fk.changeKeyObject (newRefKey, columns);

    function setting in preferences, you will get the question on the columns of FK.

    Therefore, a part of the transformation
    our logic model for the relational model is to swing all FK associations for these areas of research codes
    in the table of common code. Then the paintings representing the research areas can be removed from hard.

    You can create the hierarchy of entities with the root attribute (and PK identifier) KP holding entity and entity - your look-up - empty child relationships will be these entities of the child. With the help of the transformation of the "unique Table" you will get what you are trying to achieve now with script.

    Philippe

  • Combine one script with each other

    Dear people,

    This script works, only it exports to many!

    Is it possible to combine part 1 2 wth?

    //PART 1 > Combine this part….
    
    
    
    
    try {
        var callExport = app.menuActions.itemByID(113411);
            callExport.invoke();
    }
    catch (_) {alert(_)};
    
    
    
    
    
    
    //PART 2 >.…with this part.
    
    
    if(app.documents.length != 0)
    {   
              var myFolder = Folder.selectDialog ("Choose a Folder");   
              if(myFolder != null)
              {   
                        myExportPages(myFolder);   
              }
    }   
    
    
    else
              {   
                        alert("Please open a document and try again.");   
              }   
    function myExportPages(myFolder)
              {   
                        var myDocument = app.activeDocument;   
                        var myDocumentName = myDocument.name;   
    
    
                        app.scriptPreferences.version = "6.0"
    
    
                        app.activeDocument.sections.everyItem().includeSectionPrefix = false; 
                        p = app.activeDocument.pages.everyItem().getElements();
                        for (i = 0; i < p.length; i++)
              { 
    f = File (myFolder + "/" + p[i].textFrames.item ('jpgname').contents + ".jpg");
    app.jpegExportPreferences.pageString = p[i].name; 
    app.activeDocument.exportFile (ExportFormat.jpg, f ); 
    }   
    } 
    
    

    Thanks for all who wish to help!

    Greatings from Holland.

    What do you want the combination to do?

    The first part, actually app.menuActions.itemByID(113411).invoke() , called file > export....

    The second part runs app.activeDocument.exportFile ().

    Both export the file. In general, you should not be to invoke the menu actions in scripts if you can avoid it, they are not really designed for automation. But please explain what you are trying to accomplish. Use words much more!

  • I have a problem with the content of spam. Somewhere in the Fox appeared script that's choking me audio spam. Every 30 minutes he's playing an audio clip that is malicious.

    Hello.
    I have a problem with the content of spam. Somewhere in the Fox appeared script that's choking me audio spam. Every 30 minutes he's playing an audio clip that is malicious. I can't find the settings as it eliminated. Now, I don't have any plug-ins and Add-ons strange that were not initially in the Fox, but the problem is there.
    I use the Fox years. The problem, he had 1.5 months after Fox cleaning. If the problem can't win, I'll be forced to give up the browser, and I wouldn't.

    Could test you mode without failure of Firefox? It is a standard diagnostic tool to disable some advanced features of Firefox and extensions. More info: questions to troubleshoot Firefox in Safe Mode.

    Does not work if Firefox: Hold down the SHIFT key when you start Firefox.

    If Firefox is running: You can restart Firefox in Mode safe mode using either:

    • button "3-bar" menu > "?" button > restart with disabled modules
    • Help menu > restart with disabled modules

    and OK reboot.

    Two scenarios: A small dialog box should appear. Click on 'Start mode safe' (not update).

    Any improvement?

    If the problem persists in Mode without failure, could reinstall you Firefox in this way:

    Clean reinstall it

    We use this name, but it isn't about deleting your settings, this is to ensure that the program, files are clean (not incompatible, corrupt or exotic code files). As described below, this process does not disrupt your existing settings. Don't uninstall NOT Firefox, that does not need.

    (1) download a fresh Installer for Firefox 38.0.5 of https://www.mozilla.org/firefox/all/ in an ideal location. (Scroll down your preferred language).

    (2) close Firefox (if applicable).

    (3) to rename the program folder, either:

    (Windows 64-bit folder names)

    C:\Program Files (x86)\Mozilla Firefox
    

    TO

    C:\Program Files (x86)\OldFirefox
    

    (Windows 32-bit folder names)

    C:\Program Files\Mozilla Firefox
    

    TO

    C:\Program Files\OldFirefox
    

    (4) run the installer you downloaded in the #1. It should automatically connect to your existing settings.

    Any improvement?

    Note: Some plugins can only exist in this OldFirefox file. If it is missing something essential, present in these files:

    • \OldFirefox\Plugins
    • \OldFirefox\browser\plugins
  • Is it possible to prevent the right click context menu of the combination of Stop/Reload?

    Is it possible (subject: config tweak or something) to prevent the context menu of the combination of Stop/Reload?

    Screenshot of what I mean: http://picsend.net/images/873089StupidReloadSto.png

    Try to add this code in the file userChrome.css below default @namespace.

    Customization files (interface) userChrome.css and userContent.css (Web sites) are located in the chrome folder in the user profile folder.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #context-stop,#context-reload[hidden="true"] { display: -moz-box!important; }
  • EXC in ev handl: TypeError: this.oRoot.enable is not a function that is popping up when I befor I open my browser in a box pop up under the heading JAVA SCRIPT EXE. That is - what, how can I get rid of him?

    TypeError: this.oRoot.enable is not a function

    This is popping up when I befor I open my browser,in a pop up box under the heading JAVA SCRIPT EXE. What is it, how do I get rid of it?
    

    For me, this happened from disabling, but do not uninstall McAfee site Advisor. Recommend site completely uninstalled and the problem disappeared completely. I had turned off before site Advisor, but it seems after a update to McAfee, he was back and then turn it off again caused this problem.

    Go to "uninstall a program" or "add/remove programs" in control panel. Find McAfee in your list (McAfee total protection for me). Click it and then click "Uninstall/Change" (right there in XP, up above in Vista or 7). I don't remember exactly what you see after that, but at one screen I was given the choice to uninstall the McAfee total protection and/or the Site Adviser. You can just check the Site Adviser and just uninstall the Site Adviser while retaining the rest of the McAfee protection.
    

    Good luck!

  • Re: How to disable the function and the combination of the space bar key?

    How can I change the combination Fn + space?
    If I hit him, it changes the resolution of the screen. terrible :(

    p.s. I asked this question ten minutes ago, and now he's disappeared from the forum Board. does not pass the prior restraint?

    In the past, that Toshiba used utility zoom and this utility has been installed as an application unique os it wasn't the problem to remove it from the system.
    This application is now part of the Toshiba system parameters. I've checked my Satellite with Win8 and I find didn t the way how to turn off this option.

    I hope that someone else knows how to do this. I would also like to turn it off.

  • The combinations of keys FN on my Satellite L Windows 7 stopped working

    The combinations of keys FN on my Satellite L650 - 1 Hz, Windows 7 Home stopped working. Can someone tell me how to make them work again? And ideally, why they stopped?

    Try to restart flash cards. Start > all programs > Toshiba > utilities > restart Flash Cards

    If this will not help, try reinstalling additional package from Toshiba.
    Remove the preinstalled version and install the latest version of http://www.toshiba.eu/innovation/download_drivers_bios.jsp

    Please post comments.

  • Is it possible to use the batch is script to retrieve the value window server political group?

    Y at - it a batch command that will allow me to recover the value of group policy in Windows server? Something like gpedit.msc did, but I want because of the command line I want to convert this value to format I want.

    Example: If I open gpedit.msc, then I go to Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment\Restore files and directories so I can get the value (administrators, backup operators) of this policy.

    All ways in the batch script can bring me to this path and capture value?

    Thanks, your help is very appreciated.

    Hello

    You could try to look at the list of Group Policy scripts or repost the question to the Scripting Guys or in Forum Windows Server forum.

    The guys from script

    Windows Server

  • How to build the table with all the combinations of a source table?

    Hello

    I have a 2D array that contains the list of the power user-defined settings. The number of PSs (table rows) is not fixed. For example - 3 PSs:

    Stage of Min Max name

    PS1 3.0 3.6 0.3

    PS2 0.9 1.2 0.1

    PS3 1.7 1.9 0.1

    I need to build, from this list, a table of all the combinations as below:

    PS1 PS2 PS3

    3.0 0.9 1.7

    3.0 0.9 1.8

    3.0 0.9 1.9

    3.0 1.0 1.7

    3.0 1.0 1.8

    3.0 1.0 1.9

    3.0 1.1 1.7

    3.0 1.1 1.8

    3.0 1.1 1.9

    3.0 1.2-1.7

    3.0 1.2-1.8

    3.0 1.2-1.9

    3.3 0.9 1.7

    3.3 0.9 1.8

    3.3 0.9 1.9

    3.3 1.0 1.7

    3.3 1.0 1.8

    3.3 1.0 1.9

    3.3 1.1 1.7

    3.3 1.1 1.8

    3.3 1.1 1.9

    3.3 1.2 1.7

    3.3 1.2 1.8

    3.3 1.2 1.9

    3.6 0.9 1.7

    3.6 0.9 1.8

    3.6 0.9 1.9

    3.6 1.0 1.7

    3.6 1.0 1.8

    3.6 1.0 1.9

    3.6 1.1 1.7

    3.6 1.8 1.1

    3.6 1.1 1.9

    3.6 1.2 1.7

    3.6 1.2 1.8

    3.6 1.2 1.9

    How to build this table programmatically?

    (Note also that the number of rows in the source table is not fixed).

    Thanks in advance!

    Hi Berezka,

    using a magic of automatic indexing:

  • View CD can't mistake of player Director, was not found in the object #getPropRef, Script error. Continue?, yes no

    OT: Error player Director, not found in the object #getPropRef, Script error. Continue?, Yes No. nursing student cannot run his CD CD practice to work on other laptops. but not on it!

    Nursing Student cannot carry out its practice CD which comes with Prentice Hall Nursing book: "medical and nursing care 2nd edition, comments & justifications surgical."  CD works on PC and a laptop running Windows XP, Vista and Windows 7 and on an iMac; but not on it!  She has a Toshiba laptop with Windows Vista Home Premium and it just doesn't work!  My wife has lent her one of its laptops with Windows Vista, but the CD works fine.  What is the problem? I called Prentice Hall and got no help from them!  They said it was a computer problem.  This student is an exchange student and she would really any help.  I tried to clean the system and even tried the Optimizer5.2 perfect for the correction of errors in Script, but it didn't work.  Help please!  My only recourse is to backup all files and wipe the disk clean and start again to do a reinstall of all applications.  Any other ideas?  She had the phone since 2005 and the hard drive has only about 30% free space left on 147 GB.

    Hello cobblestone47,

    1. What is the version of the steering drive you use on your computer?

    2. the other users who are able to play the CD using the Director or shockwave player player is

    Player de Macromedia Director is also known as the Shockwave Player. I suggest that you uninstall the Director player and install the latest version of Shockwave player, and check if you have the same problem.

    You can follow the link below to download and install the latest version of Shockwave player:

    http://get.Adobe.com/Shockwave/

    Thank you
    Irfan H, Engineer Support Microsoft Answers. Visit ourMicrosoft answers feedback Forum and let us know what you think.

Maybe you are looking for