Struggling to run Powershell scripts / commands

Hi all!

I'm fighting to get the Powershell vCO workflow.  I think I missed something really obvious, but I can't see it...

I did the set Kerberos in place on the line of my vCO 5.5.2 machine.  I added a Powershell v2 host using VMWare provided Powershell 1.0.4 workflows plugin install, Kerberos authentication and using a shared account (mine, I know that I am an admin on Windows Server).  I assured the Kerberos authentication and unencrypted traffic is accepted on the Powershell host.  If I validate the object created at the CVO, he says it's fine.

When I come to run another VMware provided workflow, I get responses to error because the workflow doesn't seem to be properly trained, or I get a null response.  When I run a workflow, I can see my account by logging in the Windows Server 2008 security log, so I'm pretty confident that the basic connection and portions of Kerberos are all ok.

I just tried to simplify a VMware provided workflow, to make it as a possible base (code below).  I always get a Null response.  Anyone have any ideas why?  Or did someone is able to provide the code for a very simple Powershell-based workflow that they know works so I can test it on my set up?

The VMWare-based simple powershell script provided one to get the contents of some directories and the values that I use - it returns null:

the hostentry, type: PowerShell:PowerShellHost, value: < myPowershellHostSelectedFromPluginManually >

Directoryentry, type: String, value: I manually enter $home.  Or C:.  Or C:\Windows.  Or any other directory I know there is that my user account has no light problem.

output of the result, type: string, value: regardless of the ("DIR" + directory) output >

var Sess;

connect to the host

Sess = host.openSession)

Send the command in powershell

sess.addCommandFromString ("dir" + directory)

invoke the command

invResult = sess.invokePipeline ();

get the result

Result = invResult.getResults)

Send to open a session

System.log ("Result is" + result)

Thank you very much in advance!

And there we go...  Who sets: powershell.exe wasn't in the path of the Windows host!

Thanks for the help everyone, especially igaydajiev for giving me the pointer of the final to my answer!

Tags: VMware

Similar Questions

  • Running Powershell script with ESXCLI commands via a scheduled task in Windows 2012 does not work.

    I'm trying to run a powershell script of a scheduled task in Windows 2012. The script calls the commands ESXCLI and ends with success (exporting to a CSV file) but the file has no data inside.  If I run the script manually without the scheduled task file has all the I expect to exit.

    I wonder if there is a framework with Powershell or a PSSnapin I need to add to the script for it to run via a scheduled task.  Has anyone done this before with the ESXCLI commands?

    panhvr - you may to something.  The process account that I use to run this script has only read-only access in vCenter.  I logged on the server I am running these reports with the process ID and tried to run the script.  He gave me errors indicating permission to perform the operations of esxcli was denied.

    I think we found the culprit!  I'll have this process ID in vCenter rights upward.

    Thank you all!

  • Get-QADComputer fails if run PowerShell script through Orchestrator workflow

    I use the "Get-QADComputer" cmdlet in my .ps1 script that is supposed to run via Orchestrator.  I have several PowerShell scripts started by Orchestrator and run on a host windows without any problem.  For this script, I have these 2 commands and still error.  The script does not error when run locally.

    Add-PSSnapin Quest.ActiveRoles.ADManagement - ErrorAction SilentlyContinue

    $Computer = get-QADComputer-identity "server01" | where {$_.name - eq "server01"}

    In troubleshooting, I ran Get-PSSnapin and can see that the snap for AD is loaded successfully.  I tried Connect-QADService and who also gives the same error, although it works very well on place.

    I use vCO 5.1.1. device.   On the hosts Windows where are the scripts PowerShell, the AD snap is version 1.6.0.2683.

    Here is the error in the logs Orchestrator...

    PowerShellInvocationError: Errors found during execution of script

    System.Runtime.InteropServices.COMException (0x8007054B): the specified domain does not exist or could not be contacted.

    at Interop.ActiveDs.IADsOpenDSObject.OpenDSObject (String lpszUserName, String lpszPassword, String lpszDNName, Int32 lnReserved)

    to Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.AdsiDirectory.NativeBind (adsPath String, AuthenticationTypes bindFlags)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.AdsiDirectory.BindToObject (String dn)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.ConnectorFactory.Create (String serverName, user String, SecureString password, type of ConnectorType)

    to Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.ConnectionAwareCmdlet.EstablishConnection (ConnectionProperties connectionProperties)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.ConnectionAwareCmdlet.GetContainer)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet.BeginProcessing)

    at System.Management.Automation.Cmdlet.DoBeginProcessing)

    at System.Management.Automation.CommandProcessorBase.DoBegin)

    (Name of the dynamic Script Module: invokeScript #14)

    Thanks for the info.  I use the workflow "Invoke an external script" to run many of my host admin PowerShell scripts.  It is easier for me to keep all .ps1 files in one place and not import them into Orchestrator.  The article prompted me to switch my connection to host basic Powershell to Kerberos.  To do this, I had to update /etc/krb5.conf on the device of the vCO.  I've referenced VMware KB2036986 to work around the problem "unable to get kdc for the Kingdom.  This issue was mainly because we couldn't have krb5 configured previously.

    Now, I got a different error during execution of the workflow after bouncing vCO.

    System.NullReferenceException: Object Reference not set to an instance of an object.

    Has pointed out me the need to first make the connection AD.  He has not worked before without Kerberos authentication.  Once I added these lines of code, Get-QADComputer finally worked without error!   Thanks for the help.

    $pass = ConvertTo-SecureString - AsPlainText-Force - String "password".

    Connect-QADService - "example.com\serviceaccount" ConnectionAccount - ConnectionPassword $pass

    $Computer = get-QADComputer-identity "server01" | where {$_.name - eq "server01"}

    Disconnect-QADService

  • 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é

  • Newbie question - tide may run a remote PowerShell script or BAT file?

    My first post.  I am new to raz, but I've had experience with other planners.

    I have a PowerShell script that must be run on a remote computer.  All the script needs software is installed on this computer.

    In addition, I need the script runs under a service account.  Is it possible and if yes, how can I go about it?

    This work will be be launched manually whenever this is necessary.

    Sure. There are some screenshots. A variable one, I used for the location of the folder on the server of tide (not required but I use a lot of scripts). One for the command of tide itself. The last one is the script runs remotely on windows work. Let me know if they don't make sense.

  • How to run a Powershell script via a batch file

    I'm new on using Powershell and I have a fundamental question regarding running a powershell script. Basically, I wrote a file of commands as shown below.

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe - PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" - NoExit-command "C:\MyScripts\RunSpanshot.ps1".

    I run the batch file and nothing seems to happen. What is the problem with trying to run the RunSpanshot.ps1 script as shown above? -any help is appreciated.

    Thank you

    You could do

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -NoExit -Command "& 'C:\My Scripts\RunSpanshot.ps1'"
    
  • How to run multiple Powershell scripts in PowerCLI

    I have a large number of scripts that I would run into lots of PowerCLI. I found a way to call some Powershell scripts from a file of commands like the following (with the permission of Jan Egil Ring), which works very well except for scripts PowerCLI where a connection to a VC or ESX Server must be established before the script can be executed:

    PowerShell-command '& C:\MyScripts\script1.ps1 '.

    PowerShell-command '& C:\MyScripts\script2.ps1 '.

    PowerShell-command '& C:\MyScripts\script3.ps1 '.

    If a VC connection is on using Connect-VIServer PowerCLI, then scripts can each be run from the prompt without connection information and credentials, however, if scripts are placed in a file of DOS commands, it is necessary to place an order Connect-VIServer in each script, which will prompt you for credentials every time , so if I have 10 scripts, I will have to enter the credentials of 10 times. Is it possible to establish the connection and then run a set of Powershell scripts, or is there a way to integrate the identification information in the script so that it will connect to the VI server without asking confirmation?

    Thank you

    Ed Z

    2 options 1 persist credentials on disk, you can find the code on poshcode.org to do.

    Option 2 is to use - Session when using Connect-VIServer. The session is stored in the variable $defaultVIServer. If write you it to a file you can load this file and re-use this same session, assuming that it is still valid (i.e. it has not expired.)

  • Foglight initialize a command on the PC and run a script that makes a sound or a banner on hold the workstation?

    How can we get foglight to invoke a command on the pc and run a script that makes a noise or a banner on my computer

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-administrators/f/4788/t/19552156#14120

    The question really selectively running a sound in a JavaScript browser session, do not turn something local on the user's PC.  The Sonic equivalent of an animated GIF as an analogy.

    The most difficult part, in Java, play a sound through various types and versions of browser without opening a 'player '.  This has been an incredibly difficult task by Oracle, on behalf of the whole being.  If you really want to dive into it, here are some links:

    http://docs.Oracle.com/javase/7/docs/TechNotes/guides/sound/programmer_guide/contents.html

    One approach that seems to have some promise for very small sound files is:

    http://stephengware.com/projects/soundtoclass/

    I got no time to mess around with it yet.

    This seems to have some promise, but still once, have not figured out how to operate:

    import java.awt.Toolkit

    Toolkit.getDefaultToolkit () .beep)

  • Running a script powershell in a workflow

    Hi all

    Everyone was able to integrate a simle powershell script from a workflow job. Try to get a custom powershell script to be run from a workflow. There are a few specific elements of application checks the script. I hope that I can plan this workflow at a time affecting the operation.

    Has anyone seen any documentation on the development of workflows.

    Thanks advance.

    Please check thread

  • Planning and running my script powershell crashed Windows 7

    Hi all

    I created a powershell script that works perfectly when I run it using powershell. Just, it reads XML files and email some information on their part. But as soon as I have this schedule using the Windows Task Scheduler and run it, it blocks the windows. First of all, trying to open the Task Scheduler, after planning script, it give error, the Task Scheduler service is not available. Then I rebooted my system, and windows starts in recovery mode. I even tried windows recovery to a point recorded earlier, but also, that did not help. My BUSINESS team had to redeploy full Windows 7 on my system. I already tried this on two different systems, both with Windows 7 Professional and it crashes in the same way.

    Please help me understand what I am doing wrong.

    I don't know how to download my forum script, please let me know if any of you wish to have a look, and I'll send my code.

    Thank you

    Vittoz

    _______@____.com

    Hello Ashish,

    Thanks for posting your question on the Microsoft community.

    This question fits better to the developers on MSDN forums.

    I suggest you to ask your question on the MSDN forums.

    MSDN forum
    https://social.msdn.Microsoft.com/forums/en-us/home?category=windowsdesktopdev

    Thank you

  • Run the powershell script in Workflow VCO

    Hi guys,.

    I'm pretty new to VCO and I am facing difficulties to get what I want. For you, this will be a Basic... but here's my question:

    I have a WF that I use in the WFStubmachineprovisionning that can generate me a name of virtual machine based on the selection of the user while he asked for a virtual computer in the VRA.

    The VM provisionned name looks like this: W203PKLXXX and I need to replace the XXX with a number that is available on the network.

    To do this, I need to query the DNS to see if there is, if not, 002 001... And so on... until an available and I send the full name of the virtual machine to the WF Stubprovisionning.

    This my first try to interact between VCO and a Powershell script. I can run script PS on my host configured, but do not know how to send variables to the custom WF that generates the name of the script of PS and send the name of VM from the script of the PS to the next step.

    Can someone give me a sample of variable to manage? I can't find anything on the net

    Just to tell you that I managed.

    the PS has returned an XML object, not a string. I had to use the method getxml() javascript property, and parse the string to get the value I need

    I also had to blind correctly (getxml) entry and exit (PS)

    If needed I can send you a few screenshoot

  • a way to run a powershell script?

    Y at - it another way to configure a script to be able to run by either double clicking on it or other means other than having opened powercli and goes the script and it works.

    It is not the best way to do it, but to help people not use powercli it will help running. The script that I know is very well to run... we are running win2k8 if it matters

    You can create a shortcut and under properties make it a race of PowerShell.exe.

    You pass as an argument to the PowerShell script runs.

    In the script, you ensure that the pssnapin PowerCLI is loaded.

    For example, the target of the shortcut can be

    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe-fichier 'MyScript.ps1.

    You add in MyScript.ps1

    Add-PSSnapin VMware.VimAutomation.Core

    before that the script uses a PowerCLI cmdlet.

  • Running Powershell as remote command

    We lack 5.4.1 I thought I was supposed to run Powershell commands natively, but the only option I see is to run VBscript. Did everyone not just encapsulates their orders of Pwershell in a VBscript?

    Jom,

    vCM 5.4.1 support the dataclass custom Windows PowerShell information.  To access it, you must create a custom information (Win) filter.

    Thank you

    John

  • Run the cmd PowerShell script

    Hello

    I am trying to run a powershell script from a file cmd with the snap of VMware has added. Here's what I'm trying to run:

    PowerShell.exe - noexit Add-PSSnapin VMware.VimAutomation.Core | k:\work\DeployVM.ps1

    He adds the snap, and then launches the ps1 in Notepad, which is obviously not what I'm after. I'm sure it's something simple I'm missing, but I can't get it. The reason why I want to run it this way is to associate with a button, vb, I've sorted everything else, just this last piece, I need to finish.

    See you soon,.

    Josh

    If there is a reason that you do not add the Add-PSSnapin VMware.VimAutomation.Core as the first line of your script, then you can run it as below:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe - PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" "& C:\MyScript.ps1 '"

    If you found this information useful, please consider the allocation of points for correct or helpful.

    Alan Renouf

    http://Virtu-al.NET

  • Running a script from the command line

    Hi all
    First of all, I'd like to say I'm just starting ORACLE 11 g with no prior experience of the database. I currently lectures once a week. However, I am stuck with a problem. I am trying to access my database of the United of the House so I can do some work, apparently I can only access it via the command prompt (which is good for me) I began by downloading a shell www.putty.org secure and I managed to connect to my database of test of the University from my laptop at home. However, I have a createHR.sql of script file that is stored in my C:\ORACLE directory which I try to access in order to load my test tables and start practicing with them.
    use command line

    SQL > C:\ORACLE\createHr and I get SP2-0310: unable to connect to the file "C:\ORACLE\create HR.sql".

    normally, this should load and run the script - as with the browser method guests will get the tables is created and the test data.

    I am now officially frustrated that I can't get any done practice, offered any help will be welcome.

    Concerning

    Claude

    Published by: 891128 October 12, 2011 09:33

    Published by: 891128 October 12, 2011 09:41

    Published by: 891128 October 12, 2011 09:44

    891128 wrote:
    I started by downloading a shell www.putty.org secure and I managed to connect to my database of test of the University from my laptop at home.
    However, I have a createHR.sql of script file that is stored in my phonebook C:\ORACLE

    These two sentences above are essential. If I had to bet a directory C:\ORACLE assumption is located locally on your laptop. However, it seems you have done a SSH connection to your server and connected to the database using SQL * more customer on the server. The client on the server has no idea or access to files on your machine.

    You must open the script on your laptop and copy / paste into your SQL SSH * more session or you will need to find a way to copy this script on the server, so you can run it.

    I hope this helps!

Maybe you are looking for

  • Satellite C660-1 p 3 - poor sound quality

    Hello. I bought this phone today and I'm so confused.The sound quality is MEDIUM-low. No bass, no color just a little of his dish.Even a simple cell phone got its best, then my laptop doesn't. Where is the so-called "Toshiba Bass enhanced system"? Ca

  • Phone call widget (Contact)

    Here's one that I didn't know. Did someone knows if there's a widget you can put on your home screen, the contact whose number will consist of call when you press on? If so, I'd like to know. Bravo Maestro

  • How to add text to my video instead of creating Notes?

    I'm trying to add text to my video because I'm not like the notes thing anyone know how?

  • The Task Manager doesn't have the tabs at the top.

    I am running Windows 7 Home Premium. Only, I get the screen to process. I don't have the tabs at the top. I don't see the "Applications", "Processes", 'Perforamce' or 'Network' tab. This has happened just recently. I use to make them. Can anyone help

  • The question of different model numbers.

    Hello, I am considering buying Clip + locally (Poland), but I noticed that the product code is different from that of, say, Amazon.co.uk. Amazon.co.UK is SDMX18R-004GK-E57 and offered locally SDMX18-004GK-E57. Now I wonder what does the 'R' part in t