invoke vmscript and batch file

Hi guys

I try to activate a windows vm using the command to invoke vmscript powercli

cmd /c slmgr / ato works fine when I run a back order but when I call it via a script, then the script just hangs

I also tried to put the command above in a batchfile locally on the system and just use call vmscript to run the batch file, but which hangs just as

no idea what I'm missing?

$test = "cmd /c slmgr/ato.

Invoke VMScript - Scripttype beats - ScriptText $test VM - $vm - GuestUser - GuestPassword - administrator

Can you try to force a non-GUI run, as

cscript c:\windows\system32\slmgr.vbs

instead of just slmgr?

Tags: VMware

Similar Questions

  • Invoke VMScript and escape from the variables

    Hello, VMTN,.

    I have what is probably a simple question.  I have a set of functions that are passed to two variables; the name of a virtual computer and NIC to enable\disable in Windows in this VM.  The name of this NETWORK adapter has spaces, which is the Network Interface 4.  The service continues to set the command to inject as:

    $cmd = "game of the name of the interface c:\windows\system32\netsh.exe interface =""$NICtoEnable" "admin = ENABLED"

    It then calls the cmdlt invoke-vmscript as follows:

    ScriptType bat - invoke-VMScript - VM $VMName GuestCredential - $GuestCredential - $cmd ScriptText

    and it does not return the output, but I get "Invalid parameter" in return.  What that tells me, that is it runs netsh in the virtual machine, but on parameters is not set correctly.  I don't know that it is because I have not properly escaped the $NICtoEnable variable in $cmd of the GET passed to-ScriptText.  I also tried, instead of double quotes, using single quotes ('... ") does not.

    Any help would be greatly appreciated and thanks in advance.

    Best,

    @dboftlp

    Try your $cmd like this

    $cmd = "c:\windows\system32\netsh.exe interface set interface name=" + '"' + $NICtoEnable + '"' + " admin=enabled"
    

    The trick is to move the quotes around the name of the NIC, where single quotes around the double quotes.

  • MaxL Script and batch file

    I have a MaxL script that exports data from different cubes Level0. I have a batch file to call this script at daily intervals.

    I want to name something out of different every day (preferably NAMEmmdd type format). I know that I can add a rename or move the lot but wonder if there is a MaxL method that will allow me to export to another name?

    Current MaxL is simply
    export database APP. Level0 data_file DB database ' ' $Arborpath\am1119.txt "";

    Ideas or direction to go learn the answer?

    T,
    J

    Hello

    You can enter variables in maxl, so you the calling batch file can pass in a variable that contains the name of the file with the current date...

    For example, you have a batch file
    essmsh c:\temp\export.mxl "C:\temp\output%DATE:~3,2%%DATE:~0,2%.txt".

    If that was run today it would pass in ' C:\temp\output1118.txt

    Now in your maxl you just refer to the variable with

    export data from database sample.basic Level0 to data_file $1;

    $1 refers to the variable which has been adopted, the 1 being the position, in which it was adopted.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Dynamic object and Batch files

    At the moment I am creating hundreds of icons in the same form and style. essentially, I made more than 100 icons and then realized that I wanted to add a high effecton of each of them. I already have the layer how I want and in fact a dynamic object. I was wondering if there is any combination of actions I can take to save and then apply as a batch operation for not having to manually correct each icon. The purpose of layer/chip would go to the exact same spot for each icon. Thanks for the ideas or help, you can provide.

    Using the file > Place to insert a file that contains the layer can be recorded in an Action, which should be able to be used with the file > PLC > then in batches.

  • Problems with bash and invoke vmscript

    Hello

    Run command via invoke vmscript and it works perfectly on a linux VM what follows, but executed via vmscript invoke the output is empty.

    Bash script:

    y = a; for ((i = 1; I < = "$(ls/dev/SD? |))) WC - l) '; ((++ I)); No udevadm info - q all the sd - n $y | grep "P:". y = $("$y» l'écho |) ("tr" 0-9a - z "" 1 - 9A - z_ '); fact

    The release of linux (which is correct):

    s00002: ~ # y = a; for ((i = 1; I < = "$(ls/dev/SD? |))) WC - l) '; ((++ I)); No udevadm info - q all the sd - n $y | grep "P:". y = $("$y» l'écho |) ("tr" 0-9a - z "" 1 - 9A - z_ '); fact

    P: /devices/pci0000:00/0000:00:10.0/host0/target0:0:0/0:0:0:0/block/sda

    P: /devices/pci0000:00/0000:00:10.0/host0/target0:0:1/0:0:1:0/block/sdb

    s00002: ~ #.

    PowerCLI script:

    $script = ' y = a; for ((i = 1; I < = "$(ls/dev/SD? |))) WC - l) '; ((++ I)); No udevadm info - q all the sd - n $y | grep "P:". y = $("$y» l'écho |) ("tr" 0-9a - z "" 1 - 9A - z_ '); fact '

    Invoke-VMScript - ScriptText $script VM - s00002 - GuestUser ' root' - GuestPassword 'vmware '.

    Display the PowerCLI:

    ScriptOutput

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|  not found device node

    |  not found device node

    |

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

    If I causes an error in the script, I get the following result:

    ScriptOutput

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|  bash:-c: line 0: about syntax error unexpected token ';

    |  bash:-line c: 0: "y = a; echo (); for ((i = 1; i < = "2"; ++ i)); No udevadm info - q n - all the sd | grep "P:". y=""; fact '

    |

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

    Notice how all the variables are missing - I am guessing that it is the cause of the first error "not found device node.

    Anyone know how I can fix this problem?

    TIA

    Problem solved - updated for PowerCLI 5.5R1 to 5.8R1, now it works

    PowerCLI C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI > = $script ' y = a; for ((i = 1; i<="$(ls ev/sd?="" |="" wc="" -l)";="" ++i));="" do="" udevadm="" info="" -q="" all="" -n="" sd$y="" |="" grep="" "p:";="" y="$(echo" "$y"="" |="" tr="" "0-9a-z"="" "1-9a-z_");="">

    PowerCLI C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI > Invoke-VMScript - ScriptText $script VM - s00002 - GuestUser ' root' - GuestPassword 'vmware '.

    ScriptOutput

    ---------------------------------------------------------------------------------------------------------------------------------|  P: /devices/pci0000:00/0000:00:10.0/host0/target0:0:0/0:0:0:0/block/sda

    |  P: /devices/pci0000:00/0000:00:10.0/host0/target0:0:1/0:0:1:0/block/sdb

    |

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

  • There is a possibility to run Labview projects or to set them off from a batch file or if the exist and the ability to control labview or run it from an external application?

    Hi, I m a bit new in LabVIEW and I'd like to ask a few questions...

    -There is a possibility to run Labview projects or to set them off from a batch file or if the exist and the ability to control labview or run it from an external application?

    -One API PI or raspberry beaglebone exists for LabVIEW?

    -Power supply Wich can recommend you control with LabVIEW? (some chip solution witn 0 - 30v / 0 - 3A DC)

    Thank you very much for your advice!

    Best regards

    Elena

    Elena,

    I know raspberry, so no comment on that.

    For the rest:

    -Do you want to create tools for developers? If so, we must look in the API of project VI and VI server. If this isn't the case, please compile your application LV as executable and call this one using a batch file.

    -LV prefer specific supplies. LV is a programming language. There are several power supply providers (including OR) which provide directly the LV API for their power supplies. So, essentially, the approach is:

    1. choose food that serves your needs.

    2. check if the power supply has a standard interface for programming (such as Ethernet, GPIB, or if the power supply is PXI, is already providing a programming interface!)

    3. check if the LV API (so-called "instrument driver") is available for the device. In the case of a PXI system, get you a device driver (for example NI DCPower).

    4. check if the LV samples are available (for example in the Finder for example LV once you have installed the driver).

    Norbert

  • How to restart and stop the system by running a batch file?

    Can any body give the command batch file for restart and stop of the system.

    My requirement is to reboot or shut down the system at a specific time. So I think that by creating a batch file, that I can schedule the file to run at a specific time of the scheduled task...
    With regard to:
    Rahma.

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited on MSDN. Please post your question in the MSDN forums. You can follow the link to your question:

  • Batch file to open all files in a folder, one by one and run a script.

    I'm looking for a batch file, to run a script on each file file in the folder and open all files in a folder in the path defined and close the file. How is it possible

    Anthony,

    I would have you post here for assistance more.

    http://social.technet.Microsoft.com/forums/en-us/home?category=windowsxpitpro

    We know if that helps.

  • For Dell, HP, et al.: Batch file. Copy and paste in Notepad as netfix.bat

    Hello

    NETFIX.bat an 'L' of the command file

    Not important, but most of what follows is true. It's just a HOW2 simplified for initial review. It is not a definitive guide, don't forget...

    Never believe anything, everything you hear, and only about half of what you see; in particular within this document.

    DISCLAIMER: This is my own personal scribbles used to create a batch file to reduce the typing needed to use some of the commands in my network A2Z nonsense & applying a low degree of automation. Now, I'm not able to ensure the effectiveness of the controls on my system, because it isn't really broken. So use you it at your own risk, your levels of configuration & special access is certain to be different to mine.

    It was written using Notepad and is the plain text that can be scrutinized, edition, amended and implemented by almost everyone.

    @ECHO  THIS MIGHT HELP TO REPAIR/RECTIFY
    @ECHO  SOME SIMPLE NETWORK DIFFICULTIES.
    @ECHO         based on work by
    @ECHO  Kevin Arrows, Jim Eshelman et al.
    @ECHO ....................................
    @ECHO.
    @ECHO   THE RESULTS MAY VARY ACCORDING TO
    @ECHO   YOUR CONFIGURATION AND USER LEVEL
    @ECHO    A RESTART SHOULD BE MADE AFTER
    @ECHO    THE RUNNING OF THE ABOVE TESTS
    @ECHO ....................................
    :MENU
    @ECHO.
    @ECHO ....................................
    @ECHO.
    @ECHO   TYPE IN THE RELEVANT MENU NUMBER
    @ECHO.
    @ECHO ....................................
    @ECHO.
    @ECHO  0 - GET_MAC Obtain MAC address(es)
    @ECHO  1 - GET_IPs Lists all IP addresses
    @ECHO  2 - ADDRESS Force/Renew IP address
    @ECHO  3 - DNS_FIX Flush and Register DNS
    @ECHO  4 - WINSOCK Reset to remove errors
    @ECHO  5 - IPV4_V6 Reset to remove errors
    @ECHO  6 - PING_LO Ping tests to Loopback
    @ECHO  7 - NETSTAT All Network Statistics
    @ECHO  8 - SYS_SUM System Summary Windows
    @ECHO  9 - EXITNOW Close this Command Box
    @ECHO.
    @ECHO ....................................
    @ECHO OFF
    SET /P M= Choose from 0 - 9, then press ENTER:
    IF %M%==0 GOTO GET_MAC
    IF %M%==1 GOTO GET_IPs
    IF %M%==2 GOTO ADDRESS
    IF %M%==3 GOTO DNS_FIX
    IF %M%==4 GOTO WINSOCK
    IF %M%==5 GOTO IPV4_V6
    IF %M%==6 GOTO PING_LO
    IF %M%==7 GOTO NETSTAT
    IF %M%==8 GOTO SYS_SUM
    IF %M%==9 GOTO EXITNOW
    ::
    :GET_MAC
    GETMAC
    GOTO MENU
    ::
    :GET_IPs
    ipconfig
    GOTO MENU
    ::
    :ADDRESS
    ipconfig /release
    ipconfig /renew
    ::
    :DNS_FIX
    ipconfig /flushdns
    
    Ipconfig /registerdns
    
    GOTO MENU
    ::
    :WINSOCK
    netsh winsock reset catalog
    
    GOTO MENU
    ::
    :IPV4_V6
    netsh int ipv4 reset reset.log
    netsh int ipv6 reset reset.log
    GOTO MENU
    ::
    :PING_LO
    ping 127.0.0.1
    GOTO MENU
    ::
    :NETSTAT
    netstat -e -s
    GOTO MENU
    ::
    :SYS_SUM
    msinfo32
    GOTO MENU
    ::
    :EXITNOW
    EXIT
    

    Hello

    HOW?

    Well make HP machines, I'm a.  I wrote the code on mine, I ran and tweaked.  Since it is part of the operating system provided with my camera, it must be relevant.

    So when someone asks what is/where or how to find MAC address, he covered (0 GETMAC).

    If someone reports their Wi - Fi dropping out after a short time a possible solution in the list (4 WINSOCK

    You want to know your IP... (1 GET IPs)

    Trial material basis, ping your loopback (6 PING_LO).

    etc etc.

    Then as a sticky it could potentially help solve quite a few queries.  In the same way as The Great Deku Tree posted a sticky on the "Common corrects problems of wireless connectivity", to get ahead of the game by offering something that the OP can try for themselves.

  • LEARNING OF BATCH FILES AND WINDOWS CANNOT FIND ' C:\DOCUMENTS'__

    Technical info: Windows XP Pro SP 2. Microsft Office home and Student 2007. AVG Free 9.0.

    Hello

    I am trying to learn the basics of Batch files and am confused right now. I can get a. BAT file to produce a BACK screen and play with some commands, but when I try to get a. BAT file to open a MS Word 07 Doc I get the following message

    Windows cannot find 'C:\Documents '. It stops at Documents. When infact the entire address would include Documents\testdoc or something else. I use Notepad to write the. BAT files.

    If I go into the file target itself and copy and paste the address in XP search utility, it locates the file (with a full name), instantly. But if I do the same copy and paste, paste the address directly in. BAT file for example: C:\windows, DEPARTURE etc etc... It is just straight up with the above mentioned error message.

    All advice forge kindly appreciated. My ultimate goal is to learn how to create a Batch file that will erase the files in different directories about five or six on the click of a button.

    Thanks Mick.

    I'm not an expert in writing .bat files. If no one else is here, you should post on the MSDN forums or there may be a group of newsgroups for .bat file writing.

    http://social.msdn.Microsoft.com/forums/en-us/categories

    I'm sorry that I wasn't able to help you.

    MS - MVP - Elephant Boy computers - don't panic!

  • Problems with batch files and command.

    I'm not too familiar with the support of the PC, but can follow the operational base.

    I had a problem with my windows vista machine.  Whenever I started, there was a poster on my screen batch file.  This was a company script provided departmental support of PC does not recognize.  It was as if the batch file has been stuck in a mode where it would display only instead of execution.  After a bit of back & comes with our IT supports people, they agreed to look into the problem.  They went under launch programs to ensure that batch files have been executed with the cmd program.  Now, it displays a MS-DOS window whenever I start.  I don't know why this is so.

    As my company IT Department is unable to help, I hope someone can give me some advice.

    Is there a place to check to find out WHY this dos window appears every time and how I could fix this situation.  I can't that hope that corporate batch files are run correctly.

    Thank you

    Ken

    Hello Ken,

    1. Since when are you facing this problem?

    2. the recent changes to the computer?

    3. is the computer on the domain by chance?

    If so, the question you have posted is related to Windows in adomain of work environment and would be better suited to the TechNet community. Please visit the link below to find a community that will support what ask you

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

    If not,

    I suggest you to put the computer in aclean boot state .

    To help resolve the error and other messages, you can start Windows Vista by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    See the link below for more details:

    How to troubleshoot a problem by performing a clean boot in Windows Vista:

    http://support.Microsoft.com/kb/929135

    Note:

    When you are finished troubleshooting, follow these steps in the section above to reset the computer to start as usual.

    Kind regards

    Savan - Microsoft technical support.

  • Simple two program start and kill the Batch file

    Hello all :)

    (Today) I am new to the script of the machine. It is something that I put in place and will try tomorrow.

    CD /d "C:\path".
    Debut.bat

    CD /d "H:\path".
    Beginning Program.exe

    : CHECK
    ping localhost 10 1 n > ZERO
    AV TASKLIST /fi "IMAGENAME eq program.exe" 2 > & 1 > NULL
    IF ERRORLEVEL 1 GOTO CHECK

    Taskkill /f /im cmd.exe/t

    If all goes well, .bat runs. A program will be executed. CMD will then search for program.exe until not found (released), then close the CMD.

    In this case program.exe does not work with start/wait

    I wonder if the check will slow down my machine if worked for a few hours.

    I use Windows 7 x 64, SSD, 16 GB RAM and AMD 8350.

    Considering the insertion of a small time-out, but seems ridiculous.

    Is there a way to slow down the check, but always close immediately if program.exe is closed? Other alternatives? Thanks :)

    The original manuscript of lots above is more suited for a loop that could sleep until needed, thus reducing CPU cycles

    -> You can easily find it by yourself:
    1. launch the batch file

    2. start the Task Manager.

    3. click on the performance tab.

    4. Add the "CPU Time" column.

    5. sort the list next to the name of the task.

    6. take note of the time CPU for cmd.exe.

    7. check once again the batch file run for an hour.

    I bet that time CPU will be negligible. I expect the timeout function to be very frugal. Tasklist.exe takes more time, but it runs only once every 20 seconds.

  • URGENT -: How do you remote deploy fichier_MSI right Admins (if necessary) with a batch file or command for Windows XP and Windows 7 clients

    I'm trying to deploy the inventory of snow to 300 Clients more desktop computers / laptops (the corporate network).   But I don't want to use GPO because we have large VDI and computer Thinclient community and some of the Group Policy objects are mixed in these platforms

    Can someone help, I need a batch file or the batch file or the same VBS Script.  I have a list of the computers, so tried PSEXEC, but doesn't seem to work, may be I syntaxs evil

    Customer names: arcadia_client_x86.msi and arcadia_client_x64.msi

    Help!

    You will have to go on Support of Windows 7 forums on the following link to help solve your problem: http://social.technet.microsoft.com/Forums/en/category/w7itpro/

  • Windows 7 and I have a batch file to copy files from 1 computer to another. It works fine alone, but when I put it to run in the Task Scheduler it shows it ends successfully, but nothing is happening

    I am running Windows 7 and I have a batch file to copy files from 1 computer to another.  It works fine alone, but when I put it to run in the Task Scheduler it shows it ends successfully, but nothing is happening.  None of the files are copied, and the control box does not appear.  Any ideas?

    Run a batch file in Task Scheduler

    Hello ITGIRL17,

    Thanks for posting on the Microsoft answers Forum.

    Configure your task under your administrator account.
    Then go to the folder with the batch file and ADD on control for the folder administrator permissions and each of the files in batches.
    If the batch files write data, then the target for the task should ALSO have all explicit permissions.
    Now try to run the Task Scheduler task.

    Also check the information from the following link and look specifically at Brian Vandemark Sommaire steps on 2 September.
    http://social.technet.Microsoft.com/forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe

    I hope that this information will help resolve your batch file does not problem.

    Sincerely, Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Call the batch file and not the shell script using measures of the event

    Can I use EVENTACTIONS at the door of gold like

    eventactions (SHELL, /path-to-batch-file/test1.bat)

    will this work? I am on a windows machine, so I need to run a batch file and not a shell script

    In GGSCI, you can shell OUT to the BONE and call a command/executable file.

    For example on Windows:

    GGSCI (WIN2003) 2 > shell dir

    Volume in drive C has no label.

    Volume serial number is 8CCC-9E58

    Directory of C:\ggs

    18/08/2012 07:23

    .

    18/08/2012 07:23

    ...

    2010-10-15 06:37 bcpfmt.tpl 426

    2010-10-15 06:37 bcrypt.txt 1 725

    22/04/2011 03:41 2 560 category.dll

    05/11/2011 10:43

    cfg

    2010-10-15 07:15 739 chkpt_ora_create.sql

    ...

    What were the results when you tried this in an EVENTACTIONS clause?

Maybe you are looking for