Sign in to follow this  
Followers 0
clarkster26

Bitsadmin job creation issues

3 posts in this topic

I cannot get it to run inside of autoit. If I take the same command and dump it in a console it works fine. What am I missing?

 

BitsAdminCheck()
Func BitsJob() ;Checks if job is running and creates it if it is not
 If Not FileExists("C:bitstransferLibreOfficeLibreOfficePortable.exe") Then
  RunWait(@ComSpec & " /c 'bitsadmin.exe /create libre", @SW_HIDE)
  RunWait(@ComSpec & " /c bitsadmin.exe /addfile libre 192.168.10.11installationNetworkInstall$libreLibreOfficePortable.exe c:bitstransferLibreOfficeLibreOfficePortable.exe", @SW_HIDE)
  RunWait(@ComSpec & " /c bitsadmin.exe /resume libre", @SW_HIDE)
 Else
  If FileExists("C:bitstransferLibreOfficeLibreOfficePortable.exe") Then
   Inst_LibOff()
  EndIf
 EndIf
EndFunc   ;==>BitsJob
Func BitsAdminCheck() ; Bitsadmin verify and install if needed
 If Not FileExists("C:\Windows\System32\bitsadmin.exe") Then
  FileInstall("C:scriptsbitsinstallerbitsadmin.exe", "C:\Windows\System32\bitsadmin.exe", 1)
 ElseIf FileExists("C:\Windows\System32\bitsadmin.exe") Then
  DirSetup()
 EndIf
 DirSetup()
EndFunc   ;==>BitsAdminCheck
Func DirSetup() ; Creates the dir to copy file or files on workstation
 Local $sFldr1 = "C:bitstransfer"
 Local $sFldr2 = "C:bitstransferLibreOffice"
 If DirGetSize($sFldr2) <= 0 Then
  DirCreate($sFldr1)
  DirCreate($sFldr2)
 Else
  BitsJob()
 EndIf
EndFunc   ;==>DirSetup
Func Inst_LibOff()
 ;script to install libre
EndFunc   ;==>Inst_LibOff
 

Share this post


Link to post
Share on other sites



I cannot even get this to run

RunWait("C:\Windows\System32\bitsadmin.exe /create libre", @SW_SHOW)

Forgot to mention I am running this on XP but hope to run it on Win7 as well.

AutoIt version is 3.3.8.1 if that matters.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That line is different than in your script where it has an extra ' character.

Also see you are missing a backslash after 192.168.10.11 on the next line.

What is the working directory when you run the commands manually in a CMD window?

Are you running under Admin credentials and have you tried #RequireAdmin?

Jos

edit: Tested with this single line and worked fine for me:

RunWait(@ComSpec & " /k bitsadmin.exe /create libre")
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  
Followers 0