mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Help with a small script

Author Message
MTMorris

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 9/30/2009
  • Status: offline
Help with a small script Wednesday, September 30, 2009 3:23 AM (permalink)
0
Hi Everyone,
 
I'm completely new to VBScript and I need a bit of help.  I pieced together a script that opens a command prompt and calls the runas function to execute the Microsoft Office custom maintenance wizard.  Can someone take a look at it and tell me if there are any obvious problems?  It runs most of the time, but once in a while it has problems and hangs up after the runas command.  Any assistance will be greatly appreciated!
 
Function cmwWizardRun()
Dim oShell, genericPath, cmwDoc, CMWVerifier
Set oShell = CreateObject("Wscript.Shell")
Set WshSysEnv = oShell.Environment("PROCESS")
genericPath = WshSysEnv("USERPROFILE")
cmwDoc = genericPath & "\Local Settings\Temp\Office 11 Maintenance(0000).txt"
CMWVerifier = "C:\Windows\cmwverification.txt"
Dim fso, msg, f1
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists(CMWVerifier)) Then
     Exit Function
   Else
 If(fso.FileExists(cmwDoc)) Then     
  Set f1 = fso.CreateTextFile("c:\Windows\cmwverification.txt", true)
     Exit Function
 Else
  Dim WshShell
  Set WshShell = WScript.CreateObject ("WScript.Shell")
  WScript.Sleep 1000
  WshShell.run "runas /user:mydomain\mmorris"
  WScript.Sleep 1000
  WshShell.SendKeys "abcdefg"
  WshShell.SendKeys "{enter}"
  WScript.Sleep 1000
  WshShell.SendKeys "\\MYSERVER\cmw\maintwiz.exe /c \\MYSERVER\cmw\exchangeserver.cmw /qb-"
  WshShell.SendKeys "{enter}"
  WshShell.SendKeys "exit"
  WshShell.SendKeys "{ENTER}"
  set WshShell = nothing
  Set f1 = fso.CreateTextFile("c:\Windows\cmwverification.txt", true)
 End If
   End If
End Function
Call cmwWizardRun()
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.8
    mbt shoes www.wileywilson.com