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.

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

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.

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.