Jump to content
Sign in to follow this  
Steven Meier

HOw to make this VBS script work in AutoIt

Recommended Posts

The VBS code below is to create a mailbox for an already created active directory user (Mail enable a user).

I would like to have this work in Autoit but am a bit lost.

Cheers

Steve

CODE
VBS code.

strServer = "Paris"

strExchangeOrg = "CPNou"

strDomain = "DC=CPEXCH,DC=COM"

' These are the defaults, compare with your server and amend.

strAdminGroup = "First Administrative Group"

strStorageGroup = "First Storage Group"

strStoreName = "Mailbox Store (" & strServer & ")"

' Build LDAP string

strMailbox = strMailbox & "CN=" & strStoreName

strMailbox = strMailbox & ",CN=" & strStorageGroup

strMailbox = strMailbox & ",CN=InformationStore"

strMailbox = strMailbox & ",CN=" & strServer

strMailbox = strMailbox & ",CN=Servers"

strMailbox = strMailbox & ",CN=" & strAdminGroup

strMailbox = strMailbox & ",CN=Administrative Groups"

strMailbox = strMailbox & ",CN=" + strExchangeOrg

strMailbox = strMailbox & ",CN=Microsoft Exchange"

strMailbox = strMailbox & ",CN=Services"

strMailbox = strMailbox & ",CN=Configuration"

strMailbox = strMailbox & "," & strDomain

WScript.Echo "Mailbox " & vbCR & strMailbox

WScript.Quit

Share this post


Link to post
Share on other sites

Hallo Steven Meier,

First you can embed your .vbs-script in your Autoit with the function FileInstall() oder FileOpen() & FileWrite() & FileClose()

Second you can run your vbs-script with the function Run() or RunWait()

If you want to exchange information from vbs-script to an AutoIt_script you can write the information in a file during the vbs-execution and then you can read this file with FileOpen() & FileWrite() & FileClose() . Or you StoutRead()

This are the possibilties for me. Bye Johannes


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

Hallo Steven Meier,

First you can embed your .vbs-script in your Autoit with the function FileInstall() oder FileOpen() & FileWrite() & FileClose()

Second you can run your vbs-script with the function Run() or RunWait()

If you want to exchange information from vbs-script to an AutoIt_script you can write the information in a file during the vbs-execution and then you can read this file with FileOpen() & FileWrite() & FileClose() . Or you use StoutRead()

This are the possibilties for me. Bye Johannes


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

Hallo Steven Meier,

First you can embed your .vbs-script in your Autoit with the function FileInstall() oder FileOpen() & FileWrite() & FileClose()

Second you can run your vbs-script with the function Run() or RunWait()

If you want to exchange information from vbs-script to an AutoIt_script you can write the information in a file during the vbs-execution and then you can read this file with FileOpen() & FileWrite() & FileClose() . Or you use StoutRead()

This are the possibilties for me. Bye Johannes


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

I would prefer not to call a file as I am using this in an APP I have created for Helpdesk people to make it easy for creation of active directory users etc and basic tasks without having to go through multiple apps or multiple servers.

I would like to place the converted VBS script into autoit and compile and would prefer not to be outputting to files and then re inputting as this seems inefficient.

I know it can be done but I dont have the skill to convert it.

Cheers

Steve

Share this post


Link to post
Share on other sites

$s_strServer = "Paris" 
$s_strExchangeOrg = "CPNou" 
$s_strDomain = "DC=CPEXCH,DC=COM" 

;' These are the defaults, compare with your server and amend.

$s_strAdminGroup = "First Admini$s_strative Group"
$s_strStorageGroup = "First Storage Group"
$s_strStoreName = "Mailbox Store (" & $s_strServer & ")"
$s_strMailbox=""
;' Build LDAP $s_string
$s_strMailbox = $s_strMailbox & "CN=" & $s_strStoreName
$s_strMailbox = $s_strMailbox & ",CN=" & $s_strStorageGroup
$s_strMailbox = $s_strMailbox & ",CN=InformationStore"
$s_strMailbox = $s_strMailbox & ",CN=" & $s_strServer
$s_strMailbox = $s_strMailbox & ",CN=Servers"
$s_strMailbox = $s_strMailbox & ",CN=" & $s_strAdminGroup
$s_strMailbox = $s_strMailbox & ",CN=Admini$s_strative Groups"
$s_strMailbox = $s_strMailbox & ",CN=" + $s_strExchangeOrg
$s_strMailbox = $s_strMailbox & ",CN=Microsoft Exchange"
$s_strMailbox = $s_strMailbox & ",CN=Services"
$s_strMailbox = $s_strMailbox & ",CN=Configuration"
$s_strMailbox = $s_strMailbox & "," & $s_strDomain
MsgBox(0,"","$s_strMailbox="&$s_strMailbox)
;WScript.Echo "Mailbox " & vbCR & $s_strMailbox
exit
;WScript.Quit
Randall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...