User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 428,211 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,186 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 713 | Replies: 6
Reply
Join Date: Jul 2008
Posts: 4
Reputation: stooartbaby is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
stooartbaby stooartbaby is offline Offline
Newbie Poster

.sh to vbs

  #1  
Jul 20th, 2008
Hi Everyone,

Is it possible to convert a .sh script to VBS? If so, how should I go about this pls?

The issue is that i have found a script which does exactly what i need, but it is written as a .sh we are a pure windows shop and have very little experience with Unix boxes.... so somehow converting this to VBS would be great...

Thanks,
Stuart.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 275
Reputation: eggi is on a distinguished road 
Rep Power: 1
Solved Threads: 26
eggi eggi is offline Offline
Posting Whiz in Training

Re: .sh to vbs

  #2  
Jul 21st, 2008
I don't think there's any product out there that will do this for you automatically, at least I couldn't find one.

You'll probably have to do a straight-up port on your own. If you can post the script here (not too long and I'm not asking for you to reveal confidential info), perhaps I - or someone else here - might be able to help you.

Also, check the guidelines for this forum, you might get better help in the "Visual Basic" or "VB.Net" forums with regards to this.

Best wishes,

Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Join Date: Apr 2008
Posts: 39
Reputation: omrsafetyo is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
omrsafetyo omrsafetyo is offline Offline
Light Poster

Re: .sh to vbs

  #3  
Jul 22nd, 2008
The best thing to do would be to find someone who is fluent in both vbs and shell scripting in order to have them convert the script for you. This may cost some money, especially depending on the size of the project.

The thing of it is, is that most windows scripting languages are very task oriented - there are certain aspects of the operating system that a particular scripting language is meant to be used for administrating. Shell scripting on the other hand is simply a collection of tools that are available on almost all *nix distributions, bound together by an interpreter (whether it be ksh, csh, sh, or awk). There really aren't a lot of limitations there. The windows script host is an interface to the graphical options that are available in windows - whereas the graphical interface for *nix distributions are an interface to the shell commands.

I can certainly help you with this task, as I am a confident programmer with both languages (in fact, shell scripting and vbscript are my two specialties). Depending on your own ability, you may be able to do it yourself as well. Elaborate on how involved this script will be - the number of lines of code, the aim of the script, etc. and someone can give you an idea of what it is going to take - but you certainly will not find an automatic translator.
Reply With Quote  
Join Date: Jul 2008
Posts: 4
Reputation: stooartbaby is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
stooartbaby stooartbaby is offline Offline
Newbie Poster

Re: .sh to vbs

  #4  
Jul 22nd, 2008
Here is a copy of the .sh script... the idea is that it updates the configuration of Dell remote access cards which are in-built into Dell servers.

I would greatly appriciate some help, I have zero vbs skills... : (

+++++++++++++++++
#!/bin/bash

# File containing a list of IP address - one in each line
ipfile=ipaddr.txt

# This is the drac configuration file which contains the configuration.
dracconfigfile=drac.cfg

# Logfile to store the logs of the execution
logfile=config.log

# RACADM command to be executed
racadm_command="racadm -u root -p password"

if [ ! -r $ipfile ]; then
	echo "IP address file $ipfile not found or cannot be read"
	exit
fi

if [ ! -r $dracconfigfile ]; then
	echo "DRAC configuration file $dracconfigfile not found or cannot be read"
	exit
fi

# Logfile gets overwritten everytime this script is executed
echo "Starting batch configuration of DRAC from file $ipfile" > $logfile

while read line; do

	# Ingnore blank lines
	[ -z "$line" ] && continue

	# Ingnore comments (lines with a ;)
	echo $line | grep "^;" > /dev/null
	[ $? -eq 0 ] && continue

	echo Configuring DRAC at ip address: $line

	echo "========================================" >> $logfile
	echo "DRAC IP = $line" >> $logfile

	echo y | $racadm_command -r $line config -f drac.cfg >> $logfile 2>&1
	if [ $? -ne 0 ]; then
		echo "Failed. See logfile for details"
	else
		echo "DRAC configured successfully"
	fi

done < $ipfile

echo Done

++++++++++++++++++++
From this point on it is the Drac.cfg file data...

[idRacInfo]
# idRacType=6
# idRacProductInfo=Dell Remote Access Controller 5
# idRacDescriptionInfo=This system component provides a complete set of remote management functions for Dell PowerEdge servers
# idRacVersionInfo=1.33
# idRacBuildInfo=08.07.11
# idRacName=DRAC 5

# To change username or password for a user
# Note: cfgUserAdminIndex line should be commented

[cfgUserAdmin]
# cfgUserAdminIndex=4
cfgUserAdminUserName=username
cfgUserAdminPassword=password

[cfgUserAdmin]
# cfgUserAdminIndex=5
cfgUserAdminUserName=username
cfgUserAdminPassword=password

[cfgUserAdmin]
# cfgUserAdminIndex=6
cfgUserAdminUserName=username
cfgUserAdminPassword=password

# For more users copy paste the entire sections

# To add and enable a user use the section below
[cfgUserAdmin]
# cfgUserAdminIndex=9
cfgUserAdminUserName=username
cfgUserAdminPassword=password
cfgUserAdminPrivilege=0x00000000
cfgUserAdminIpmiLanPrivilege=15
cfgUserAdminIpmiSerialPrivilege=15
cfgUserAdminSolEnable=0
cfgUserAdminEnable=1


# To configure Active directory uncomment these lines
# and edit the values

# [cfgActiveDirectory]
# cfgADEnable=0
# cfgADRacDomain=ourplace.org.au
# cfgADRootDomain=ourplace.org.au
# cfgADRacName=testdrac
# cfgADAuthTimeout=120
# cfgADType=1
# cfgADSmartCardLogonEnable=0
# cfgADCRLEnable=0
# cfgADSpecifyServerEnable=0
# cfgADDomainController=0.0.0.0
# cfgADGlobalCatalog=0.0.0.0
# cfgAODomain=0.0.0.0

# [cfgStandardSchema]
# cfgSSADRoleGroupIndex=1
# cfgSSADRoleGroupName=dracgrp
# cfgSSADRoleGroupDomain=ourplace.org.au
# cfgSSADRoleGroupPrivilege=0x000001ff
Last edited by Tekmaven : Jul 22nd, 2008 at 6:41 pm. Reason: Code tags
Reply With Quote  
Join Date: Jul 2008
Posts: 4
Reputation: stooartbaby is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
stooartbaby stooartbaby is offline Offline
Newbie Poster

Re: .sh to vbs

  #5  
Jul 22nd, 2008
Hmmm... just got a warning email... I must have done something wrong....

If the text is not available to you then I can send it via private message...

Thanks,
Stuart.
Last edited by stooartbaby : Jul 22nd, 2008 at 6:49 pm.
Reply With Quote  
Join Date: Apr 2008
Posts: 39
Reputation: omrsafetyo is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
omrsafetyo omrsafetyo is offline Offline
Light Poster

Re: .sh to vbs

  #6  
Jul 23rd, 2008
The text is available, it was just a bit hard to read because you hadn't enclosed it in code tags.

It doesn't look like an overly complicated script - though I wonder if you have racadm installed? Then whether or not it has a command line utility on windows as well as on *nix. I'd have to look into that a bit.
Reply With Quote  
Join Date: Jul 2008
Posts: 4
Reputation: stooartbaby is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
stooartbaby stooartbaby is offline Offline
Newbie Poster

Re: .sh to vbs

  #7  
Jul 23rd, 2008
Hi There,

The racadmin utility will only install an a machine with a Dell remote access card installed... it is just the way Dell have written the application.

More infor can be found here:

http://en.wikipedia.org/wiki/Dell_DRAC#Remote_console

Thanks,
Stuart.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 3:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC