PDA

View Full Version : Simple for you. Hard for me. Help if you can.


1Strive
01-04-2008, 08:12 PM
Hi everyone,
1STRIVE here.

I am not a programmer. I hardly ever have to write my own scripts. Batch files is about the extent of what I do. I am a windows system admin.

I have a batch file to add shares to a cluster and I want to get it to use parameters and then pull the answers from a txt or csv file. Or I want input boxes to pop up for the answers.

Here is what I have.

cluster resource "MGMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "MGMT1$" /priv Security=Everyone,set,R:security
cluster resource "MGMT1$" /priv Security=Administrators,set,F:security
cluster resource "MGMT1$" /adddep:"Disk V:"
cluster resource "MGMT1$" /priv ShareName=MGMT1$
cluster resource "MGMT1$" /priv Path="V:\MGMT1"
cluster resource "MGMT1$" /priv Remark=Fuji
cluster resource "MGMT1$" /on

This works like a champ, but I need to repeat it 50 times with different "Share Names, Disk, and Path"

The next one would look like this.
cluster resource "ATHMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "ATHMT1$" /priv Security=Everyone,set,R:security
cluster resource "ATHMT1$" /priv Security=Administrators,set,F:security
cluster resource "ATHMT1$" /adddep:"Disk T:"
cluster resource "ATHMT1$" /priv ShareName=ATHMT1$
cluster resource "ATHMT1$" /priv Path="T:\ATHMT1"
cluster resource "ATHMT1$" /priv Remark=Fuji
cluster resource "ATHMT1$" /on

So, any help will be appreciated. Thanks,
1STRIVE

erocker
01-04-2008, 08:30 PM
Hi everyone,
1STRIVE here.

I am not a programmer. I hardly ever have to write my own scripts. Batch files is about the extent of what I do. I am a windows system admin.

I have a batch file to add shares to a cluster and I want to get it to use parameters and then pull the answers from a txt or csv file. Or I want input boxes to pop up for the answers.

Here is what I have.

cluster resource "MGMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "MGMT1$" /priv Security=Everyone,set,R:security
cluster resource "MGMT1$" /priv Security=Administrators,set,F:security
cluster resource "MGMT1$" /adddep:"Disk V:"
cluster resource "MGMT1$" /priv ShareName=MGMT1$
cluster resource "MGMT1$" /priv Path="V:\MGMT1"
cluster resource "MGMT1$" /priv Remark=Fuji
cluster resource "MGMT1$" /on

This works like a champ, but I need to repeat it 50 times with different "Share Names, Disk, and Path"

The next one would look like this.
cluster resource "ATHMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "ATHMT1$" /priv Security=Everyone,set,R:security
cluster resource "ATHMT1$" /priv Security=Administrators,set,F:security
cluster resource "ATHMT1$" /adddep:"Disk T:"
cluster resource "ATHMT1$" /priv ShareName=ATHMT1$
cluster resource "ATHMT1$" /priv Path="T:\ATHMT1"
cluster resource "ATHMT1$" /priv Remark=Fuji
cluster resource "ATHMT1$" /on

So, any help will be appreciated. Thanks,
1STRIVE

Honestly as an ameteur programmer at best, I would have to do each one individually.:ohwell:

1Strive
01-04-2008, 08:42 PM
Honestly as an ameteur programmer at best, I would have to do each one individually.:ohwell:

Yeah, me too. But at least we know it can be done.:toast:

adrianx
01-16-2008, 01:07 PM
you can reduce your "work" if same variable are fixed :)

a visual basic script will help you...

but

frist you need all the date... in 1-2 list

also you must be sure that the list is 100% corect

and the script must write a file ...

cluster resource "ATHMT1$" /create /group:"Group 00" /Type:"File Share"
cluster resource "ATHMT1$" /priv Security=Everyone,set,R:security
cluster resource "ATHMT1$" /priv Security=Administrators,set,F:security
cluster resource "ATHMT1$" /adddep:"Disk T:"
cluster resource "ATHMT1$" /priv ShareName=ATHMT1$
cluster resource "ATHMT1$" /priv Path="T:\ATHMT1"
cluster resource "ATHMT1$" /priv Remark=Fuji
cluster resource "ATHMT1$" /on

and in this file the script must insert the data from the file

also the script must sent to execution that file ... or simple to name the file with an incremented name ... same like ... file1, file 2... etc..

and in the end you will run a script to run all the file you crated
:D

but ... this only helping you if you know ho to write that script..

(it's posible to cost more time that you write manualy all the commands) :D

adrianx
01-16-2008, 01:08 PM
and a simple ideea

think twice and afther that start working :)

DanTheBanjoman
01-16-2008, 01:24 PM
Perhaps you could look into KIX, quite a simple script language for logon scripts.

mrtn400
01-17-2008, 12:01 AM
I could help you make a small app in C++ that generates the long .bat file. You'd need to download Dev-C++ (http://www.bloodshed.net/devcpp.html) so you could compile the source.
(Yes, just joined. Been ghosting a while and joined so I could try to help you. Normally on OCN.)

Edit: Or I could make you the program 100% if you give me the list of "Share Names", "Disks", and "Paths".

adrianx
01-17-2008, 06:41 AM
mrtn400

the list must be .. safe becouse is a list of the private network... will be a security issue to give that list to anyone.. :)

also a good admin must know what software will run in "his" network, for that he must analise the script/source from you :)

mrtn400
01-17-2008, 07:32 PM
Ah, ok. Didn't really understand it's purpose.