Answered by:
I have an application where I need to change the database folder depends on the first 3 letters of machine name?

Question
-
Note: I know that I need to make use of script to check the machine name and then the database name needs to change. But I don't know how to write a script. Please help me with the script.
Hi I have an application where I need to change the database folder depends on the Machine Location,
Check the “Computer name” to determine the correct path. The path will be determine by the first 3 letters of “Computer name” as follows:
- Computer name: HAC, choose \\hacssfs001\apps\WoodMac\GlobalEconomicModel\GEM
- Computer name: NYC, choose \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM
- Computer name: WDB, choose \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM
- Computer name: LOS, choose \\losssfs002\applications\WoodMac\GlobalEconomicModel\GEM
- Computer name: KUL, choose \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM
- Computer name: BKK, choose \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM
- Computer name: JAK, choose \\jakssfs001\applications\WoodMac\GlobalEconomicModel\GEM
- Computer name: BEJ, choose \\bejssfsgenp01\applications\WoodMac\GlobalEconomicModel\GEM
depends on tyhe first 3 letters of the Machine name we need to choose the database location. How to do this and I'm using App-V 4.6 SP1.
Please help me with this.
Thanks in advance.
Tuesday, March 26, 2013 12:15 PM
Answers
-
You could do something like this:
@ECHO OFF GOTO %COMPUTERNAME:~0,3% :HAC [commands to set option to \\hacssfs001\apps\WoodMac\GlobalEconomicModel\GEM GOTO :EOF :NYC [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :WDB [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :LOS [commands to set option to \\losssfs002\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :KUL [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :BKK [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :JAK [commands to set option to \\jakssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :BEJ [commands to set option to \\bejssfsgenp01\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF
Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.
This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.
Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V
- Edited by Aaron.ParkerModerator Tuesday, March 26, 2013 1:14 PM
- Proposed as answer by znack Tuesday, March 26, 2013 1:52 PM
- Marked as answer by Aaron.ParkerModerator Saturday, April 13, 2013 8:28 AM
Tuesday, March 26, 2013 1:13 PMModerator
All replies
-
You could do something like this:
@ECHO OFF GOTO %COMPUTERNAME:~0,3% :HAC [commands to set option to \\hacssfs001\apps\WoodMac\GlobalEconomicModel\GEM GOTO :EOF :NYC [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :WDB [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :LOS [commands to set option to \\losssfs002\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :KUL [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :BKK [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :JAK [commands to set option to \\jakssfs001\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF :BEJ [commands to set option to \\bejssfsgenp01\applications\WoodMac\GlobalEconomicModel\GEM] GOTO :EOF
Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.
This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.
Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V
- Edited by Aaron.ParkerModerator Tuesday, March 26, 2013 1:14 PM
- Proposed as answer by znack Tuesday, March 26, 2013 1:52 PM
- Marked as answer by Aaron.ParkerModerator Saturday, April 13, 2013 8:28 AM
Tuesday, March 26, 2013 1:13 PMModerator -
Thanks Aaron,
I don't have basic knowledge on scripting and how to implement that.
Request you to please help me at this point of time with where to run this and how to...
I've a question regarding to the above script,
The above script will find the computer name and then it'll pass the value depends on the computer name. But, there is nothing mentioned where or to which registry or place it needs to copy the database name.
Thanks in advance.
Tuesday, March 26, 2013 3:55 PM -
I have no idea where your application stores that information in the registry, so you'll need to find that out first. You can write to the registry with a REG ADD command. Run REG ADD /? from a command prompt to see help on how to use the REG ADD command.
Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.
This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.
Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V
Tuesday, March 26, 2013 5:31 PMModerator