How to run a command line for every folder in a share

I'm trying to use Robocopy to merge two user home directories shares from two different servers to a new server, but the only problem is that I can't use the /purge to mirror deletes because it will delete the other servers stuff (since one server's stuff
doesn't exist on the other one currently).
But I'm thinking if someone I could enumerate the folder names from the users$ share on each server, and add it to both path statements in the commands below, i could add purge since then it would be running individually per user folder, rather than at the
user level below.
robocopy "\\CurrentServer1\users$" "F:\Users" /E /B /COPY:DATSOU /R:1 /W:1 /MT /LOG:"C:\RobocopyLogs\MirrorUsers1.txt"
robocopy "\\CurrentServer2\users$" "F:\Users" /E /B /COPY:DATSOU /R:1 /W:1 /MT /LOG:"C:\RobocopyLogs\MirrorUsers2.txt
What I'm hoping is that there's some scripting genius out there who could tell me how to use a batch or vbscript to save a LOT of time.  If not, I'm doing this all by hand for hundreds of users :(
Thanks in advance for any help you can provide.

Mike and Bill are right on with your approach however, to show you why your code is not working I removed all "Smart Quotes" in favor of the following.
Refrain from commenting every line.  It makes the script impossible to follow.
$hostname='hostname'
$migrationdata='c:\migrate\IPDATA.txt'
$ip=Select-String -Path C:\migrate\IPDATA.txt -Pattern $hostname
$ip = $ip.Substring(35)
$ip = $ip.Trim()
$dns='10.10.1.10','10.10.1.11'
$gateway='10.10.4.1'
$netmask='255.255.252.0'
$dnsdomain='new.domain.local'
$msg='We will be using the following information for the new IP stack Hostname:{0}, IP address {1} Default Gateway: {2} DNS Servers: {4} DNS Suffix: {5}'
Write-Output ($msg -f $hostname,$Ip,$Gateway,$DNS,$DNSdomain)
$Config=Read-Host 'Please press enter if this is correct, and we will apply this configuration. or CTRL-C to exit'
#configure the Ip stack
$Interface = Get-WmiObject win32_networkadapterconfiguration -filter 'IPEnabled=True'
$Interface.EnableStatic($ip, $netmask)
$Interface.SetGateways($Gateway, 1)
$Interface.SetDNSServerSearchOrder($dns)
$Interface.SetDNSDomain($dnsdomain)
$Interface.SetDynamicDNSRegistration($true)
#Show the user the new IP configuration
ipconfig /allcompartments /all
$Config = Read-Host 'We have reconfigured the NIC. Does the IP configuration for the "Local Area Connection" look right? Press enter to continue to join the domain, or CTRL-C to exit'
Use sample white space to make code readable.
Much of this code does not make sense.  You should be using DHCP to set all workstations and most servers with the exception of Domain Controllers.
It will be faster to do this with PowerShell since you do not know batch.  Your attempt is not even close.
¯\_(ツ)_/¯

Similar Messages

  • How to run a command line argument

    i want to run a command line argument, say for eg......i want to execute the "dir" command on the dos prompt and capture the output.
    how can i do this.
    actually i want to capture the output of the ping command and write it to a file. can any body plsssssss help

    This command runs a ping to "address" and writes the output back to the command line. To capture it, just put strings into an array or do whatever you want with it. If you want to wait until the program completes before reading its input, use p.waitFor().
    Process p = Runtime.getRuntime().exec("ping " + address);
    BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String currLine = null;
    while((currLine = in.readLine()) != null)
      System.out.println("ping: " + currLine);
    [/code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to run ADF command-line test-client on standalone weblogic host

    I have followed the steps to create a test client for the ADF application. In used the following link:
    http://download.oracle.com/docs/cd/B31017_01/web.1013/b25947/bcquerying007.htm
    The above link does not talk about how to setup the environment where the standalone weblogic is installed to be able to run the test client.
    I can run it in the jdeveloper environment.
    I can also run from the command line on the development host, by cut-paste the command from the jdeveloper output log tab.
    I am trying to run this client on the machine where we have a weblogic installed (standalone) for testing. We can run our ADF application from the browser with no issues. We want to automate and run some testing related to the ADF model (non-viewcontroller part) from the command line on this test stage.
    Which/Where are the ADF libraries?
    How can I add our application jar deployed on the weblogic (ear file) to the CLASSPATH?
    What other libraries ADF/Weblogic do I need for the command line test client?
    What am I missing?
    Thanks for any help.
    Edited by: mmunawar on Jul 2, 2011 1:03 PM
    Edited by: mmunawar on Jul 2, 2011 1:04 PM

    create weblogic application server connection from jdeveloper and then Deploy that application through jdeveloper in the weblogic application server and then run it from jdeveloper and see if its working.

  • How to run a command line window from code?

    In an application I need to run a dll file with a few arguements. These arguements can be given in the command line window. The execution of the dll file will return a string that i need to get (for the parsing etc).
    1. How can I open a command line window from the Java code?
    2. How to run commands on it?
    3. How to get the results of the commands from the command line into my program?

    In an application I need to run a dll file with a few
    arguements. These arguements can be given in the
    command line window. The execution of the dll file
    will return a string that i need to get (for the
    parsing etc).
    A dll is used by other programs. It is not possible to run it from the command line.

  • How to run zonecfg command-line to add device in postinstall script?

    I want to assign a tape drive in non-global zone in postinstall script. I can run zonecfg with a command-file, but don't know how to run zonecfg to add device in a whole command-line.
    The command-line fails to run:
    # zonecfg -z sun1 add device set match=/dev/rmt/173b
    syntax error at 'set'
    Commands:
    add <resource-type>
    (global scope)
    add <property-name> <property-value>
    (resource scope)
    cancel
    commit
    create [-F] [ -b | -t <template> ]
    delete [-F]
    end
    exit [-F]
    export [-f output-file]
    help [commands] [syntax] [usage] [<command-name>]
    info [<resource-type> [property-name=property-value]*]
    remove <resource-type> { <property-name>=<property-value> }
    (global scope)
    remove <property-name>=<property-value>
    (resource scope)
    revert [-F]
    select <resource-type> { <property-name>=<property-value> }
    set <property-name>=<property-value>
    verify
    Thanks for your help!

    Quote the parameters and embed the newlines:
    zonecfg -z sun1 'add device
    set match=/dev/rmt/0
    end'

  • How to run using command line in oracle9i

    Hi there...I would like to know how do you a program using the command line in oracle9i JDeveloper...coz my program is processing the input typed from the user.How do you run in oracle9i Jdeveloper.

    errr Typed input would be done by typing in the console window...provided your java is waiting for keyboard input.
    If you mean as commandline parameter, then you need to modify your runtime configuration for the project.

  • How can I use srvctl command line for change "Failover type" and "F method"

    Hi all,
    I am using Oracle One Node (11.2.0.3), and I have a service:
    /u01/11.2.0/grid/bin/srvctl config service -d orcl
    Service name: orcldb
    Service is enabled
    Server pool: orcl
    Cardinality: 1
    Disconnect: false
    Service role: PRIMARY
    Management policy: AUTOMATIC
    DTP transaction: false
    AQ HA notifications: false
    Failover type: NONE
    Failover method: NONE
    TAF failover retries: 0
    TAF failover delay: 0
    Connection Load Balancing Goal: LONG
    Runtime Load Balancing Goal: NONE
    TAF policy specification: BASIC
    Edition:
    Preferred instances: orcl_1
    Available instances:
    I would like to change "Failover type" and "Failover method" to:
    Failover type: SELECT
    Failover method: BASIC
    How can I do that? Is there any graphical tool for it? Or, How can I use srvctl command line for change it?
    Thanks in advance.
    Leonardo.

    user10674190 wrote:
    Hi all,
    I am using Oracle One Node (11.2.0.3), and I have a service:
    /u01/11.2.0/grid/bin/srvctl config service -d orcl
    Service name: orcldb
    Service is enabled
    Server pool: orcl
    Cardinality: 1
    Disconnect: false
    Service role: PRIMARY
    Management policy: AUTOMATIC
    DTP transaction: false
    AQ HA notifications: false
    Failover type: NONE
    Failover method: NONE
    TAF failover retries: 0
    TAF failover delay: 0
    Connection Load Balancing Goal: LONG
    Runtime Load Balancing Goal: NONE
    TAF policy specification: BASIC
    Edition:
    Preferred instances: orcl_1
    Available instances:
    I would like to change "Failover type" and "Failover method" to:
    Failover type: SELECT
    Failover method: BASIC
    How can I do that? Is there any graphical tool for it? Or, How can I use srvctl command line for change it?
    Thanks in advance.
    Leonardo.srvctl modify service -d database_name -s orcldb -q TRUE -m BASIC -P BASIC -e SELECT -z 180 -w 5 -j LONG
    Also see
    11gR2(11.2) RAC TAF Configuration for Admin and Policy Managed Databases [ID 1312749.1]

  • Command line for end users

    Hy guys, in order to run the command line below:
    C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTEXEC.EXE /F
    "G:\SHAREDFOLDER\PIPPO.DTSX"
    Does the user need to have BIDS installed in the local machine?
    My goal is to allow end user to run packages saved in the network shared folders.
    Many Thanks

    Hi DIEGOCTN,
    The SQL Server Data Tools option installs the Integration Services components required to design a package, but the Integration Services service is not installed and you cannot run packages outside of Business Intelligence Development Studio. If we just
    want to run packages outside the design environment, we needn’t install Business Intelligence Development Studio, but we must select Integration Services on the Feature Selection page to install Integration Services.
    The following two articles for your references:
    http://msdn.microsoft.com/en-us/library/ms143731.aspx
    http://stackoverflow.com/questions/14551255/how-do-i-enable-integration-services-ssis-in-sql-server-2008
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Command line for replication setup for DS 4.16

    I am using Directory Server 4.16. I see example using command line for replication configuration in DS 5.0. Since 5.0 is quite different with 4.16. So my question is how to use command line to set up a Supplier in DS 4.16?
    I know we can use ldapmodify to do some change. I see an ldapreplica entry. I can setup supplier id and password there. It seems only change that entry is not enough. Where to setup the setup for "changedatabase", "replication schedule", "initial consumer later" something we do at the console screen?
    Your help is greatly appreciated.
    Iris

    Hi Iris
    Steps involved in Setting up Replication from command line
    Part I: On Consumer Directory Server
    1. Log on to the consumer directory server.
    2. Stop the consumer directory server
    3. Edit the slapd.conf file at <server-root>/slapd-<server-instance>/config so that it includes the following two lines. The lines show the DN of who is allowed to connect for replication and the entry's corresponding password.
    updatedn "uid=<REPLICA USER BIND DN>"
    updatepw {SHA}<SHA ENCRYPTED REPLICA USER PASSWORD>
    4. Edit the dse.ldif file at <server-root>/slapd-<server-instance>/config so that the entry cn=config contains the following two lines. These lines contain the same data as the line above.
    nsslapd-updatedn: uid=<REPLICA USER BIND DN>
    nsslapd-updatepw: <PLAIN TEXT REPLICA USER PASSWORD>
    5. Start the consumer directory server
    Part II: Creating the Replication Agreement
    1. Log on to the master directory server
    2. Stop the master directory server
    3. Edit the slapd.conf file at <server-root>/slapd-<server-instance>/config so that it includes the following two lines. This lines setup the changelog directory and suffix.
    changelogdir <dir path >
    changelogsuffix "cn=changelog"
    4. mkdir <CHANGELOG DIR>
    5. Start the master directory server
    6. Create a file named replica.ldif which contains the following lines. These lines reflect the agreement which will start the replication with the consumer; as such you should make the changes to reflect your environment.
    dn: cn=<CONSUMER FQDN>:<CONSUMER PORT>/o%3D<BASE DN>, cn=ldap://:<SUPPLIER
    PORT>,dc=<1ST ELEMENT OF SUPPLIER FQDN>,dc=<2ND ELEMENT OF SUPPLIER
    FQDN>,...,<TOP LEVEL SUPPLIER FQDN>
    changetype: add
    objectclass: top
    objectclass: LDAPReplica
    replicahost: <CONSUMER FQDN>
    replicaport: 389
    replicanickname: <CONSUMER HOSTNAME>
    cn: <CONSUMER FQDN>:<CONSUMER PORT>/o%3D<BASE DN>
    replicaroot: o=<BASE DN>
    replicabinddn: uid=<REPLICA USER BIND DN>
    replicacredentials: <REPLICA USER PASSWORD>
    replicausessl: 0
    7. Run ldapmodify with the proper authorization so that the entry is added correctly.
    8. There is an optional attribute which can be tacked on to the bottom of the above entry. The attribute 'replicabeginorc' will tell the server to immediately start on-line replication; this will initialize the consumer by deleting all the current entries on the consumer one at a time and then adding all the entries from the master one at a time. If this is something you want to do, do an ldapmodify adding this attribute to the entry you just created in step 8.
    for example
    Create a file called beginreplica.ldif like;
    dn: cn=xymox.mcom.com:389/o%3Dinternet, cn=ldap://:389,dc=fts,dc=mcom,dc=com
    changetype: modify
    add: replicabeginorc:
    replicabeginorc: start
    then run;
    ldapmodify -h fts -p 389 -D "cn=Directory Manager" -w netscape -f beginreplica.ldif
    Hope this helps
    Roy

  • Error while running the SAP JCO java program running via command line

    Hi,
        We are facing an issue while using SAP JCO. When i try to run the sample program using RAD 8.0 ( IBM IDE tool For Java Development) its working fine.
    The same sample program if i try to run using command line, Then its giving below exception message.
    Exception in thread "main" java.lang.NoClassDefFoundError: Integration
    NOTE: I have configured proper sapjco jar & Dll files path in class path settings in my batch file.

    Hi,
    class loader can't find class definition during runtime but it could find it during compilation. So the problem is with your classpath. Does your classpath point to file with class Integration? Check this [blog|http://javarevisited.blogspot.com.au/2011/06/noclassdeffounderror-exception-in.html].
    Cheers
    Added reference to blog.

  • How to run a search query for a particular folder in KM related to portal

    Hi,
    Can any one tell me the steps for : how to run a search query for a particular folder in knowledge management related to portal.
    Answers will be rewarded.
    Thanks in advance.
    KN
    Edited by: KN on Mar 18, 2008 6:33 AM

    Ok u may not require a coding
    But u req configuration
    U should first make a search option set
    Link: [Search Option set|http://help.sap.com/saphelp_nw04/helpdata/en/cc/f4e77ddef1244380b06fee5f8b892a/frameset.htm]
    Then u need 2 duplicate a KM Command by the name Search From here
    and customize it to include the Search Option that u have created
    Link: [Search from here|http://help.sap.com/saphelp_nw04/helpdata/en/2a/4ff640365d8566e10000000a1550b0/frameset.htm]
    Then in the layout add this command.
    Regards
    BP

  • How to execute unix command line from cocoa?

    how to execute unix command line from cocoa?
    for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
    thank you.
    Power G5 Quad Mac OS X (10.4.3)

    The following article may also help:
    http://cocoadevcentral.com/articles/000025.php
    Mihalis.
    Dual G5 @ 2GHz   Mac OS X (10.4.6)  

  • How can hide the command line of a t.code in the portal

    Dear Experts.
    I have the following doubt:
    How can hide the Command Line of a Report that is called with a T.Code in the portal?
    Attach Image:
    [Image T.Code|http://www.freeimagehosting.net/uploads/eab3b6a03c.jpg]
    When I created a service using the T.Code SICF for the T.Code , I can hide buttons and the filed command line  using
    ~webgui_simple_toolbar
    ~singletransaction
    ~NOHEADEROKCODE
    With notes 1010519, "SAP GUI for HTML: Simplified Title Area Without Menu and OK Code" and 959417.
    But the problem is that when I create the service in the T.Code SICF, I also have that create an Iview IAC in the portal.
    The Question is : How can hide this fields and buttons if I want Publish the T.code using an Iview Transaction in the portal?
    In this moment I have used the two options:
    1 option) I created a service using the t.Code SICF for my Transaction and I also created an Iview IAC in the portal for call the service.
    RESULT:
    SAP Web Application Server
             500 Connection timed out
            Error: -5
           Version: 7000
           Component: ICM
           Date/Time: Sat Jun 12 20:26:39 2010 
           Module: icxxthr_mt.c
           Line: 2698
           Server: xyxab...
    Error Tag: {-}
    Detail: Connection to partner timed out after 60s
    2)  created an Iview Transaction  in the portal and  call my transaction.
    RESULT.
    [Image T.Code|http://www.freeimagehosting.net/uploads/eab3b6a03c.jpg]
    But not can hide the field Command Line and other buttons.
    I think that the command :
    ~webgui_simple_toolbar
    ~singletransaction
    ~NOHEADEROKCODE
    Only can be used if I create a service using the T.Code SICF .
    Best Regards
    Carmen.

    Hi Carmen,
    The bottom line is that this cannot be done for transaction iviews without modifying the standard webgui service in SICF, which is probably not a good idea (since it affects everyone using SAP GUI for HTML). (You could hack the appintegrator to add the ~webgui_simple_toolbar parameter to the transaction URL template in the portal, but again its not a recommended thing to do ...). Better to create an IAC service in SICF with ~webgui=1 where you set the required appearance using an appropriate value for ~webgui_simple_toolbar, and then create an IAC iview to point at this service.
    You can even override the ~transaction value configured in the new service in individual IAC iviews by entering the appropriate value in the application parameter of the iview, for example:
    ~okcode=/nSU01
    And you can pass parameters in the same way:
    ~okcode=/nSU01 USR02-BNAME=xyz;USREFUS-USERALIAS=abc;
    By the way, it would not be recommended to create a URL iview to access an IAC, since you are likely to encounter session management issues in this scenario - better to use an IAC iview.
    Regards, Rory

  • Command line for credential manager

    can anyone help me in getting command line for credential manager ... ?
    Thanks,
    VRAGHU

    If there are a lot of them you could go to a command prompt and type:
    cmdkey /list
    Or better yet:  cmdkey /list > del_creds.cmd
    Then edit the file so you are only left with, for example:
        cmdkey /delete:info-services.dev-inside.lni.wa.gov
        cmdkey /delete:info-services.inside.lni.wa.gov
        cmdkey /delete:inside.lni.wa.gov
        cmdkey /delete:lnidaptumtfs08.wads.res
        cmdkey /delete:lniduttumvm05
        cmdkey /delete:lnipstum01.wads.res
        cmdkey /delete:lnipstum02.wads.res
        cmdkey /delete:lnixapolysrm1.wads.res
        cmdkey /delete:ohr.apps-inside.lni.wa.gov
        cmdkey /delete:portal.apps-inside.lni.wa.gov
        cmdkey /delete:portal.dev-inside.lni.wa.gov
        cmdkey /delete:scsd8.unit-test.wads.wa.gov
    then run your del_creds.cmd file and they will all be gone.
    Steven Shippee

  • Command line for DISCOVERER 3.1.37

    I try to found the instructions about the command line for DISCOVERER 3.1.37 (how to activate with the username/password with the address of a workgroup on a file server)
    Where can i find informations about Command line mode and examples ?

    Hi,
    I think you need to upgrade Disco to 4.1.48, I don't think 4.1.37 works properly with Applcations 11.5.8.
    Rod West

Maybe you are looking for

  • Can anyone explain what this log means? My accounts seem to repeatedly get accessed through software, it seems to be related to apps in some form-

    Console Log entries for process: Verizon Sep 20, 2013, 1:54:45 PM - Warning Verizon[556] -[SDAppDelegate applicationDidEnterBackground:] [Line 686] Did enter background Sep 20, 2013, 1:54:45 PM - Warning Verizon[556] -[SDAppDelegate applicationDidEnt

  • JMS QueueRequestor not working ??

    Hi all. I am trying to get a Request and Reply mechanism working, but I am getting a weird exception: Exception occurred: javax.jms.InvalidDestinationException: Invalid queue. Does anyone have a suggestion ? QueueConnection queueConnection = null; tr

  • Loading external movies differently

    I am making a web site with several pages that the content will load as an external movie. Right now I have all loading with the nav buttons "on release". The first page loads through one blank clip and the rest in another. What I would like to do is

  • Can I use Sparrow as a default emailer in iPhoto '11?

    When I try to send the picture in iPhoto '11, the e-mailer choices are confined to the iphoto itself, Mail, and Outlook something. I'm using Sparrow as a default Mail client in my Mac.  Can I use it as a defaut e-mailer in iPhoto as well? Thanks.

  • Adobe Flash Query and distinction Please...

    Ok, so my local newspaper and news/weather station in Tampa (TBO.com) has been providing me some nice weather alerts with maps to my new 3G (previously, just txt alerts to my old LG). They have been working on a new release, which when I was notified