Jump to content

Bitsadmin job creation issues


Recommended Posts

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
 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...