Using computer variables in task sequence "Run Command Line"
I am attempting to deploy VMs through VMware's vRealize Automation tool using CM. The process creates a CM computer object then creates a direct rule on a CM collection for the new computer object. During the creation of the computer object vRA creates computer
variables provided by me on the computer object. I see the computer object built and i see the custom variables on the computer object:
Name Value
dns1 10.10.10.10
dns2 10.10.10.11
gateway 10.10.10.1
ipAddress 10.10.10.2
netMask 255.255.255.0
In the task sequence the last step is to "Run Command Line":
cmd /c netsh int ip set address name="Ethernet0" static %ipAddress% %netMask% %gateway% & cmd /c netsh int ip set dns name="Ethernet0" static %dns1% & cmd /c netsh int ip set dns name="Ethernet0" static %dns2% index=2
When the TS gets to that step it doesn't substitute the variables in the command with the computer variables listed above. Looking at the smsts logs after the deployment is complete I see lines stating:
Set Command Line:...
Start executing command line:...
Executing command line:...
ProgramName = ...
All of those lines show the command exactly as it is above with the %variables% intact.
The command immediately fails with the error:
Invalid address parameter (%ipAddress%). It should be a valid IPv4 address.
Does anyone have a suggestion on why the TS isn't using the variables? I found this article https://technet.microsoft.com/en-us/library/bb693541.aspx but its for 2007 not 2012. I wasn't able to find something comparable for 2012.
I don't know why anyone here thinks you *need* sccm osd to achieve fully automated customizations.
Customer selects base image (2008 r2 core, 2008r2 gui, 2012 r2 core, 2012 r2 gui), which should be thin and with zero customizations anyway,
vaai accelerated clone creates vm,
ip addr/gateway/dns config is injected with powercli,
customers config management engine agent of choice is installed via powercli script injection/execution (we have puppet users, ConfigMgr users, saltstack users, IEM users, Cheff users),
the clone completes in ~2 minutes and a VM is presented to the customer in less than 5 minutes
Deploying windows VMs via SCCM OSD is not only slow, but requires dev work on the customer side to get things rolling which wastes everyone's cycles including your own
Similar Messages
-
Using partition variable in task sequence
I need to configure a piece of software as part of a task sequence to direct some of its files to a specific partition. I have the ts creating 3 partitions and I'm specifying variables for each: DataDisk = 10GB, UsersDisk = 100GB, OSDisk = 100% remaining
free space.
The 100GB partition is the one I need the software to use. In the "Custom Tasks" section of the ts "Dump MDT Variables" step dumps all MDT variables to a text file on the local machine so I can see at that time UsersDisk = D:\, DataDisk
= C:\ and OSDisk = V:\, but after the deployment finishes UsersDisk = E:\. Also in the "Custom Tasks" section I'm running the "Configure Data Igloo" to configure the program. Is there a way to set UsersDisk = E:\ before I run
the "Configure Data Igloo" step when there's also an internal DVD drive likely using E:\?
Edit: I should add that it's all working properly at the moment but the "Configure Data Igloo" step is referencing E:\, not %UsersDisk% and I see this causing problems latter. Does anyone know how the drive letters are assigned? That is,
why does %DataDisk% = D:\ and %UsersDisk%= E:\ after deployment, why not the reverse?Thanks for the reply Keith. I'm not thrilled about having to customize the partition structure either but because we use Deep Freeze we need use Data Igloo to cache user profiles on a partition other than C:\.
What I've ended up doing is using the 'Set Task Sequence Variable' tasks to set DataDisk = D:\ and UsersDisk = E:\ and then I can reference these variables for the task that configures Data Igloo. To be clear for anyone trying to follow this, I'm not
actually changing the letter assigned to the partitions, I'm just assigning a value to a variable which is then referenced in later task sequence steps.
The thing that I'm not sure about is how the partition letters are assigned. In my case the DataDisk partition is always assigned D:\ and UsersDisk is always assigned E:\. I thought it might be alphabetical but I changed the 'Format and Partition
Disk' step to rename UsersDisk to ADisk and it still gets letter E:\.
This isn't a big deal but if anyone knows how the letters are assigned please let me know. -
TS-Run Command Line-run as different user
HI
I needed to deploy one program which do not like SYSTEM account (do not installs). So I created TaskSequence with
Run Command line and specified domain user which will be running this command.
Is my domain users password safe or it will be provided in clear text in my network? Because this user must be Admin on local computer.Just to reinforce, the tasks use standard, core Windows APIs to impersonate the account and execute the command -- these APIs never send anything in clear text and if they did, then Windows has much bigger issues. It would actually take
a huge amount of effort to not securely perform this operation.
Jason | http://blog.configmgrftw.com -
BO Edge 4.0 Installer stuck on "Run command-line executable"
Hi,
Our BO Edge BI Server 4.0 Installer on Windows Server 2008R2 is stuck on one of the last steps; "Run command-line executable".
Before is was stuck on "WaitForCMSForTheFirstTime". We upped the RAM to 16GB and then the installer went past this, but after a full reset of the server and trying again it is now stuck a few steps later on "Run command-line executable". This is very frustrating, especially since there is no error message at all, no install log and the installer is just stuck indefinitely and we had to cancel it.
At that point the Central Configuration Manager shows this:
Apache Tomcat - Running
BW Publisher Service - Stopped
SAP BO Mobile Authentication Server - Stopped
SAP BO Mobile Processing Server - Stopped
Server Intelligence Agent - Running
We can't deinstall from Windows to start over at this point because the installer says an install is in progress.
What is going on?
Help urgently needed and appreciated
Edited by: J. Knulst on Jan 11, 2012 7:48 AM
Edited by: J. Knulst on Jan 11, 2012 7:50 AMHello,
Yes, certain stages run for a long duration. "Run command-line executbale" runs for atleast 45 mins. It's normal.
My suggestion would be to leave it for 45 mins-90 mins.
Now that you have interrupted your installtion, try uninstalling it through the control panel.
In case you can't see the software there, then you have to edit registry entries, which is very tiresome.
Regards,
Sonia -
I can't find a class to run command line stuff...
Does J2SE have the capability to run command line files/executable files? I need to run some things from command line on my local machine. This ap will be swing based. Thanks for any insight.
nickthat is what I need. I did not think to look there. Thanks so much.
Nick -
Run Command Line in Task Sequence as current user
Hi guys,
So i have package that is running fine by itself as administrator. It creates folder in %USERPROFILE% if it doesn't exist. However when i put the package in task sequence it doesn't run properly since the TS is executed as System account.
Can you advise how i can run the package as the current logged on user with elevated rights in Task Sequence :)Well when i run package as standalone with %userprofile% variable in the command it runs as the current user. If i use it in task sequence i get the system profile instead. So instead of task sequence i am using one package with multiple programs to run
one after the other.
Does this make more sence? -
SSIS - How to run command line to copy files with User Variables within a Execute Process Task
Hello,
I'm am having syntax issues within the Arguments when trying to copy a file with cmd.exe using User Variables.
It works when I hard code the arguments : /c copy /b "\\folder1\file.txt" "\\folder2\file.txt"
However, it's failing when I try using User Variables to replace the directory and file.
User::FILES = \\folder1\file.txt
User::FILE_NAME = file.txt
"/c copy /b + @[User::FILES] + \" \\\\folder2\\" + @[User::FILE_NAME]"
Does anybody know what's wrong with my syntax?
Thanks!Hi SSISBeginner,
Assuming the source file is "C:\Temp\Source\file.txt", the destination folder is "C:\Temp\Destination", the expression of FILES variable is "C:\Temp\Source\file.txt", and the expression of FILE_NAME variable is file.txt. Then, we can use the following
expression for the Argument property of the Execute Process Task:
"/C COPY /B " + @[User::FILES] + " C:\\Temp\\Destination\\" + @[User::FILE_NAME]
Note: Pay attention to the spaces in the double quotes in the expression.
Regards,
Mike Yin
TechNet Community Support -
When to use unattend.xml in task sequence - best practice?
Hi, I've tried researching this but not found an answer to my specific query.
We have ConfigMgr 2012 R2 with MDT 2013 although I don't think this is an MDT specific question.
I'm trying to create a Build and Capture task sequence for our Windows Server 2008 R2 and Server 2012 /2012R2 server builds utilising an UNATTEND.XML file to make some customisations that can be deployed for every build afterwards in a Deployment Task Sequence.
Specifically the addition of some Windows Features like SNMP and it's configuration and the addition of the Telnet Client. There are other bits like language settings and configuration items but I'm specifically interested in the Features part for my question.
In CM 2012R2 you now have the option under the "Apply Operating System" to use a captured image or an original installation source. However they work differently if you specify the use of the same unattended answer file.
The "image" deployment ignores all of the "add features" sections of the XML file and the "installation source" loses the configuration options from SNMP from the XML file. When you then deploy the captured image using
the same unattend.xml again the one from the "installer" now has all the SNMP features required and the one from the "image" is still missing everything.
So my question is as follows.
What is best practice for specifying an unattend.xml file in a task sequence. Is it in the build and capture TS or in the Deployment TS ?
or
Do I need multiple XML files, one for build and capture with some bits in and another for deployment with the rest in?
or
Should I be doing something else?
Although this is specifically asking about Server O/S we will be using the same methodology for Windows 7 deployment.In this case DISM is only used to add the actual features... for configuration you could use a simple script that runs afterwards. Sample registry file:
SAMPLE REG FILE - HKLM-SNMP.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters]
"NameResolutionRetries"=dword:00000010
"EnableAuthenticationTraps"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent]
"sysServices"=dword:0000004f
"sysLocation"=""
"sysContact"=""
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\public]
"1"="127.0.0.1"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities]
"public"=dword:00000004
Sample batch file:
SAMPLE SCRIPT FILE - ConfigureSNMPService.bat
@ECHO OFF
net stop "SNMP Service"
regedit /s HKLM-SNMP.reg
net start "SNMP Service"
Also some settings for SNMP can be controlled through group policy:
http://serverfault.com/questions/285762/group-policy-for-multiple-snmp-permitted-managers -
Using java to run command line as %username%
Hi all,
can any one help with this?
I'm trying to run a command line from a database as %username% in Windows. So far I have the following script, courtesy of Frank Naude to build a java class that is published within a plsql procedure. A command line can then be passed to it.
rem -----------------------------------------------------------------------
rem Filename: oscmd.sql
rem Purpose: Execute operating system commands from PL/SQL
rem Notes: Specify full paths to commands, for example,
rem specify /usr/bin/ps instead of ps.
rem Date: 09-Apr-2005
rem Author: Frank Naude, Oracle FAQ
rem -----------------------------------------------------------------------
rem -----------------------------------------------------------------------
rem Grant Java Access to user USER1
rem -----------------------------------------------------------------------
conn sys/password@database as sysdba
EXEC dbms_java.grant_permission('USER1', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC dbms_java.grant_permission('USER1', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
EXEC dbms_java.grant_permission('USER1', 'SYS:java.io.FilePermission', '/bin/sh', 'execute');
EXEC dbms_java.grant_permission( 'USER1', 'SYS:java.io.FilePermission','C:\WINDOWS\system32\cmd.exe', 'execute' );
rem -----------------------------------------------------------------------
rem Create Java class to execute OS commands...
rem -----------------------------------------------------------------------
conn user1/password@database
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
finalCommand = new String[4];
finalCommand[0] = "C:\\WINDOWS\\system32\\cmd.exe";
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
// Execute the command...
final Process pr = Runtime.getRuntime().exec(finalCommand);
// Capture output from STDOUT...
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println("stdout: " + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
} catch (IOException ioe) {
System.out.println("Error printing process output.");
ioe.printStackTrace();
} finally {
try {
br_in.close();
} catch (Exception ex) {}
// Capture output from STDERR...
BufferedReader br_err = null;
try {
br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("stderr: " + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_err.close();
} catch (IOException ioe) {
System.out.println("Error printing execution errors.");
ioe.printStackTrace();
} finally {
try {
br_err.close();
} catch (Exception ex) {}
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
show errors
rem -----------------------------------------------------------------------
rem Publish the Java call to PL/SQL...
rem -----------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE host(p_command IN VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String)';
show errors
rem -----------------------------------------------------------------------
rem Let's test it
rem -----------------------------------------------------------------------
exec host('notepad');
The trouble is although this script works great for commands that can be run is the 'background' as SYSTEM is I want to pass a command to actually open something e.g. notepad in the above example nothing seems to happen. As far as I can make out the command line is running but not as %username% so it's not running notepad.exe in the foreground.
I'm happy to clarify more if necessary.
Can anyone help with this?
Cheers
YogBill,
Thank you for the quick answer. I believe you are right in your assumption.
I have been searching but found nothing so far.
I need to be able to run this line "wmic
Product where name='XXX XXX XXX' call uninstall"
in an elevated command prompt to uninstall the program.
I was looking for a VB script or PowerShell to execute it remotely on non domain roaming PCs.
Th3e command can be run remotely against stand-alone workstations but you must supply credentials. Post in the platform forum for you version of Windows for help in using the WMIC utility. WMIC /? will give you all of the command options fro
remote execution. UAC only affects local systems. You cannot use WMIC to remote back to the local system. WMIC does not allow impersonation to the local system.
Most installers will not automatically allow an unattended uninstall. If there is any dialog at all the uninstall will fail and can hang.
I recommend contacting the vendor of the application to get more information.
In all cases you cannot bypass UAC as Bill has noted. I am only noting that, sometimes, in a workgroup, you can use WMIC to remotely uninstall an application.
¯\_(ツ)_/¯ -
I am trying to get Office 2010 to install using a UDI task sequence, and it IS installing, but it has a yellow exclamation point next to it at the summary screen after the task sequence completes, as does another app I am trying to install.
The apps that use an .MSI are fine, and get the green check, but the two apps that use .exe for their installers get the yellow warning sign. I assume this has to do with exit codes or detection rules, but I am very new to SCCM (using 2012 and MDT
2012 Update 1), so I need some help.
Thank you!
EDIT: This probably has to do with the fact that SuccessOrFailureCode being blank. I have been pouring over .vbs scripts and logs, but they all seem to indicate that my application installs just fine, with an exit code of 0. Where does this screen
get the SuccessOrFailureCode?
Like
This
Quote
MultiQuote
EditI have some updated info on this problem.
I am trying to install Symantec Endpoint Protection with a custom wrapped .EXE file, and I have created detection rules for the install.
According to AppEnforce.log, SEP is installing and returning an Exit code of '1', and that is being handled with my custom return code handling, which I've defined as a 'success'. However, the deployment summary is still showing a yellow exclamation point
next to the SEP install, and the SuccessOrFailureCode is blank.
Why isn't the SuccessOrFailureCode equal to '1'? Where is the disconnect between the AppEnforce.log and the deployment summary. -
How to run command line argument programe
Hi guys, I am doing pass command line argument programe in java but I don't know how to run this programe. Path for this programe in my my computer is C:\Users\Desktop\Mainjava\mycode\CommandProgjava*
{code/}
public class CommandProg
public static void main(String[] args)
System.out.println("d");
for (int i = 0; i < args.length; i++)
System.out.println(args);
{code/}
Where i need to go and what command i need to give so i can execute this programe(I am using window vista). I only know i have to give
this command some where CommandProg arg1 arg2 arg3 arg4. Output should be
Output:
arg1
arg2
arg3
arg4
Please help me, Thanks in advance.
Edited by: JayVirk on Dec 30, 2007 11:33 AMJay,
Your question isn't very clear, hence Joerg's well meaning but irrelevant advise.
Do you mean:
I've written a simple program in java which echos
it's command-line arguments to back to the console.
Here's my code:
package forums;
public class ArgsEchoer
public static void main(String[] args) {
for (String arg : args) {
System.out.println(arg);
But can't figure out how to compile and run the program.
I'm using winblows shista, and it's cr@p.
Please help me, Thanks in advance.So... where are you at? Have you installed the JDK (java development kit)? Which version? Is your path set? Is your classpath set?
Start here: http://java.sun.com/developer/onlineTraining/new2java/ -
How to run command line tool in my program???
Hi,all,I've got some tools that are usually,or take JDK for example,if we are not using an IDE,we need to open the command prompt,and then use the javac command to compile the source files and the "java "command to run the program,and both of them accept some command line params.The problem is that how could i integrate the tools in my own program,like JBuilder or some other IDE,you configure the params and compile and run in the IDE which don't need to open a command line prompt.Hope i have got my question clear:)
Best regards..jesperdj ,thanks:)
actually,i am using eclipse to run my ant tasks programmatically,but I got trouble with the AntRunner class.it seems that i should config a proper classloader for it,but i just don't know how.please lend a hand:)thanks
robin -
Run command line from receiver
Hello,
I write script to transfer file from our local drive to sFTP server.
I try to run the script from Run Operating System Command After Message Processing in CC
The script not run.
When I try to run this script from our XI server from CMD the script running.
I add the script command line:
"C:\Program Files\WinSCP\WinSCP.exe" /console /script="C:\Program Files\WinSCP\fromnetafim.txt"&"C:\Program Files\WinSCP\script.bat"
I'll be happy to hear what I need to add to this line to run the script from communication channel.
EladHi,
You just post ur output file in some folder , lets say /usr/sap/sapout/test/.and the shell script in this path /usr/sap/bin/convert.sh.
Inside the File access parameters put target directory and filename scehme and for shell script give processing parameters as File construction mode , File type and OS Command and use a space after the shell script name and the %F.
And for input can use it directly.
Check out these links. First one will help you in acheiving want you want.
/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
http://help.sap.com/saphelp_nw70/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
Also have a look on this thread.
Re: RUN OPERATING SYSTEM COMMAND BEFORE MESSAGE PROCESING?
regards
Aashish Sinha
PS : reward points if helpful -
Execute Process Task :Executing DOS Command lines in Execute Process Task
Hi All,
I am trying to sftp files using Tectia Client from my local system. For that I have used the Execute Process Task in SSIS. First I open DOS command and try to instantiate the sftp3.exe.
Then I write down the below command
binary
open username@hostname
lcd C:\Test
cd <Destination Path name>
put test.txt
How to execute the command in execute process task ?
help is appreciated
ThanksHi ConnectDebz,
According to your description and script example, do you use WinSCP.exe to perform the SFTP files transfer? If so, you should set the Executable of the Execute Process Task to the path of the WinSCP.exe, save the script in a .txt file and set the Argument
of the Execute Process Task like “/script=C:\Temp\sftploader.txt” (without quotes).
References:
http://www.sqlservergeeks.com/blogs/raunak.jhawar/sql-server-bi/395/sql-server-sftp-with-ssis-execute-process-task
http://gregcaporale.wordpress.com/2012/02/23/using-sftp-in-sql-server-ssis/
Regards,
Mike Yin
If you have any feedback on our support, please click
here
Mike Yin
TechNet Community Support -
How we run command line commands in oracle
Hi,
In sql server i have an option "xp_cmdshell" i can run windows commands e.g "dir " using query analyzer.
How can i do same thing in oracle
Thanks in advance.
Regards
Faheem> MY SELECT:select OSexec('dir') as STDOUT from dual;
ERROR:-1command[dir] The handle is invalid.
In the sample code, I've executed a Linux/Unix program called date, physical file /usr/bin/date.
Is there a DATE.EXE or a DIR.EXE program that you can execute on Windows?
No. Both DATE and DIR are commands of a program - a 32bit console program called CMD.EXE.
Your confusion stems from thinking that OSEXEC is calling the Windows shell command line. It is not. It is not calling CMD.EXE and passing Window Shell Commands to CMD.EXE.
OSEXEC is calling, via Java, the Win32 API call called CreateProcess(). This is a call to the Win32 kernel. It requests the kernel to load an executable program as a process image.
The kernel expects an EXE (or executable) file to load. You are passing it a command from a program. You just as well can pass it a Java command, a MS Access Basic Command, an Excel Macro, etc... Same thing. The kernel has no idea that this "command" needs another program to be loaded, and that command be "passed" somehow to that program.
So, you need to call CMD.EXE via OSEXEC. And you can pass parameters to it. Open a Command Console and type cmd /? for help on the command line switches and parameters for CMD.EXE.
I believe the following should work:
SQL> select OSEXEC( 'c:\windows\system32\cmd.exe /c date /t') from dual;
Maybe you are looking for
-
Callable Objects-Write to System Log,Offline Approval
Hi, I am new to Guided Procedures and I am trying out examples in all callable objects. I have doubts in 2 callable object 1. Can you guide me how to use the callable object under Miscellaneous Type - Write to system Log After we Enter the Log text w
-
How do I restrict a PDF file to limited users?
I have an online website and I want to make a PDF available to the users of that website. The website in question is not important here, but what is important is to know if I can make a PDF file first of all downloadable by validating someone's email
-
I accidentally deleted Candy Crush off my phone, and when I went to reinstall it, it reinstalled but has now disappeared from my screen. I went to the app store and it says there that it is still installed. How do I get it back?
-
Hi, I'm trying to write a note for a contact. I have written following code: contact.addString(Contact.NOTE, contact.ATTR_NONE, "bla bla bla") it works, but when i write contact.addString(Contact.NOTE, contact.ATTR_NONE, "bla \n bla \n bla") it doesn
-
Hi, I have some files in Illustrator, Photoshop, and InDesign that I wish to be backwards compatible with CS5. I'm concerned more about my Illustrator files at the moment. I'm not sure how to save as a CS5 file or if there is an automatic way to make