Gregou Posted March 15, 2008 Share Posted March 15, 2008 Please help me to convert this script, something is wrong... thanks a lot, Local $WshShell, $wshnetwork, $strUser, $strComputer, $objWMIService, $WScript, $DR, $Array, $i, $IPConfig, $IPConfigSet $WshShell = CreateObject("WScript.Shell") $wshnetwork = $WScript.CreateObject("WScript.Network" ) $strUser = $wshnetwork.username $strComputer = "." $objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $IPConfigSet = $objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For $IPConfig in $IPConfigSet If Not IsNull($IPConfig.IPAddress) Then For $i=LBound($IPConfig.IPAddress) to UBound($IPConfig.IPAddress) for $j = 0 to ubound ($DR);parcours tableau DR if left($IPConfig.IPAddress($i),8) = $DR($j) then ;test de l'IP si @ DR $WshShell.Run ("outlook.exe /importprf c:\francelot\PRF_info.prf" ) ;Execution du PRF DR $chemin_dr = "\\"& left($IPConfig.IPAddress($i),8)&"1"&"\"&"users$"& "\"&$strUser&"\outlook\outlook.pst" Send("{F10}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send("{ENTER}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") send("$chemin_dr") Send("{TAB}") Send("{TAB}") Send("{ENTER}") Send("{TAB 7}") Send("{ENTER}") else $chemin_bureau = "c:\Document and settings\"&$strUser&"\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst" $WshShell.Run ("outlook.exe /importprf c:\francelot\PRF_bureaux.prf" );Execution du PRF Bureau Send("{F10}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send("{ENTER}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") send("$chemin_dr") Send("{TAB}") Send("{TAB}") Send("{ENTER}") Send("{TAB 7}") Send("{ENTER}") $wscript.quit EndIf Next Next EndIf Next Link to comment Share on other sites More sharing options...
Gregou Posted March 15, 2008 Author Share Posted March 15, 2008 Hello, Nobody can help me? i have to make an exe file to configure automaticly outlook.. Link to comment Share on other sites More sharing options...
madmikep Posted March 31, 2008 Share Posted March 31, 2008 Why not use the Office Resource Kit to configure Outlook when it is installed http://office.microsoft.com/en-us/ork2003/...1494521033.aspx Link to comment Share on other sites More sharing options...
Squirrely1 Posted March 31, 2008 Share Posted March 31, 2008 (edited) Here is a start - I converted some functions - but I don't know an AutoIt equivalent for "LBound" on line 12: expandcollapse popupLocal $WshShell, $wshnetwork, $strUser, $strComputer, $objWMIService, $WScript, $DR, $Array, $i, $IPConfig, $IPConfigSet $WshShell = ObjCreate("WScript.Shell") $wshnetwork = ObjCreate("WScript.Network") $strUser = $wshnetwork.username $strComputer = "." $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $IPConfigSet = $objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For $IPConfig In $IPConfigSet If $IPConfig.IPAddress <> "" Then For $i = LBound($IPConfig.IPAddress) To UBound($IPConfig.IPAddress) For $j = 0 To UBound($DR);parcours tableau DR If StringLeft($IPConfig.IPAddress($i), 8) = $DR($j) Then;test de l'IP si @ DR $WshShell.Run("outlook.exe /importprf c:\francelot\PRF_info.prf");Execution du PRF DR $chemin_dr = "\\" & StringLeft($IPConfig.IPAddress($i), 8) & "1" & "\" & "users$" & "\" & $strUser & "\outlook\outlook.pst" Send("{F10}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send("{ENTER}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send($chemin_dr) Send("{TAB}") Send("{TAB}") Send("{ENTER}") Send("{TAB 7}") Send("{ENTER}") Else $chemin_bureau = "c:\Document and settings\" & $strUser & "\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst" $WshShell.Run("outlook.exe /importprf c:\francelot\PRF_bureaux.prf");Execution du PRF Bureau Send("{F10}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send("{ENTER}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") Send($chemin_dr) Send("{TAB}") Send("{TAB}") Send("{ENTER}") Send("{TAB 7}") Send("{ENTER}") $WScript.quit EndIf Next Next EndIf Next Edited March 31, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now