Windows bits command line

BITS что это за служба в Windows?

BITS — интеллектуальная служба передачи данных между клиентом и HTTP-сервером. При этом при передачи используется интернет, который не используется. Как это? Например у вас интернет-пакет со скоростью 10 мегабит, а вы просто сидите в социальной сети, которая ну никак не может для отправки сообщений использовать все 10 мегабит. И вот то, что не используется — то может взять себе служба BITS для передачи данных) вот как-то так все и работает)

Но где эта служба применяется? Самое главное применение — загрузка обновлений с серверов Microsoft. Обновления могут быть большие и вот чтобы загрузка их не мешала пользователю в плане скорости — то и нужна служба BITS. Вот поэтому то он и интеллектуальная — качает с такой скоростью, чтобы вам не мешать сидеть на сайтах, или например играть в онлайн игру..)

Как я понимаю, основная фишка службы BITS — фоновая загрузка данных, при которой используется не вся скорость интерната, а только неиспользуемая.

Кроме обновлений служба также используется и в антивирусе Microsoft Security Essentials (Windows Defender).

Как я понимаю, эту службу могут использовать и другие программы. Они могут загружать файлы из интернета при помощи этой службы. Для этого программа создает задание, в котором указаны файлы, и потом это задание идет или в очередь или сразу выполняется. В общем это уже больше для разработчиков, вряд ли вам интересно)

Нужно ли отключать службу BITS? Судя по тому где она используется — нет, отключать не стоит, иначе могут быть проблемы со встроенным антивирусом или с обновлениями. Но если вы ни первым ни другим не пользуетесь — то получается отключить можно. Но опять же, а если еще какая-то программа использует эту службу? Нельзя ведь точно знать какие проги используют, а какие нет. Поэтому.. нет, лучше все таки ее не отключать. Тем более что вряд ли она может грузить ПК — разве что совсем немного и только когда идет передача данных.

Чтобы отключить службу или посмотреть, включена она или нет, то нужно открыть окошко свойств — там есть вся необходимая информация. Как это сделать? А вот как — зажимаете Win + R, вставляете эту команду:

Нажимаете ОК и потом в списке служб находите Фоновая интеллектуальная, нажимаете два раза и будет окошко свойств. Там все будет сказано. Чтобы отключить — в Тип запуска выбираете Отключена и нажимаете кнопку Остановить. Но отключать в итоге все таки думаю что не стоит.

Как и многие системные службы, BITS работает под процессом svchost.exe, тут ничего удивительного нет.

Проверка состояния службы BITS

BITS Administration Utility (bitsadmin.exe)

BITS Administration Utility — инструмент управления службой BITS. Возможно что инструмент из себя представляет команду, так как имеет параметры для запуска из командной строки:

Да, bitsadmin.exe — это команда:

Я точно не знаю — но если интересно, то можете попробовать ввести в командную строку:

И в результате может отобразиться справка по этой команде.

Вирус может использовать BITS

Но я нашел еще кое-что интересное. Впрочем ничего странного нет.. в общем вирусы тоже могут использовать службу BITS. На одном сайте читаю, что некий троян в 2016 году использовал функционал службы для загрузки вирусов на ПК. Ну тут просто без комментариев, я то думал что там в Microsoft это учли и сделали так, что загрузка могла бы быть только с безопасных источников. Но как видим — нет.

Читайте также:  Как включить wifi через командную строку windows

Сегодня тот вирус уже вряд ли опасен — информация за 2016 год, а сейчас конец 2018, и скорее всего вирус уже внесен в антивирусные базы.

Нашел даже более точную информацию — вирус назывался Zlob.Q и он использовал BITS для связи с командным центром (C&C). И как обнаружили этот вирус? Все очень просто — была подозрительная активность службы BITS, ну и начали копать, и в итоге докопались.

Возможно у вас тоже есть подозрительная активность? В любом случае, при малейшем подозрении — проверьте ПК на вирусы. Чем? Я перечислю две основные утилиты, которыми стоит проверять регулярно ПК:

  1. Первая утилита от Доктора Веба — Dr.Web CureIt!. Популярная в интернете, многие знают, одна из лучших, если не самая. Умеет чистить ПК от всяких троянов, червей, бэкдоров, находить даже те вирусы, которые используют механизмы скрытия и обусфакции. Кстати обусфакция (может неправильно написал, сори) — это когда вирус постоянно меняет свой код, чтобы его не обнаружили.
  2. Вторая утилита — AdwCleaner. Это уже немного проще утилита, но также важна и может вам сберечь нервы. Утилита ищет и удаляет не очень серьезные вирусы, но такие коварные.. и тут я имею ввиду — рекламные. Все эти вирусы, которые постоянно пихают вам рекламу, заражают рекламными ссылками ярлыки, автозагрузку, левые расширения ставят. В общем после чистки AdwCleaner комп может спокойно заработать быстрее.

Вот этими двумя утилитами я оч советую проверить ПК при малейшем подозрении на вирус. На этом все — удачи, надеюсь информация помогла.

Using BITS

The following steps show how to perform a file transfer using the Background Intelligent Transfer Service (BITS) В interfaces.

To perform a file transfer

The previous steps show how to transfer files using the default property values for a job. You can change the default behavior by changing one or more of the job’s property values. For example, you can change the priority that the job is processed relative to other jobs in the queue, specify your own proxy setting, and register to receive event notification when BITS has transferred the files. For more information, see Setting and Retrieving the Properties of a Job.

Windows PowerShell provides a simple mechanism to manage many BITS tasks. This section contains the following topics that show how to use Windows PowerShell cmdlets with BITS:

Starting with WindowsВ 10, version 1607, you can also run PowerShell Cmdlets and use BITSAdmin or other applications that use the BITSВ interfaces from a PowerShell Remote command line connected to another machine (physical or virtual). This capability is not available when using a PowerShell Direct command line to a virtual machine on the same physical machine, and it is not available when using WinRM cmdlets.

A BITS Job created from a Remote PowerShell session will run under that session’s user account context and will only make progress when there is at least one active local logon session or Remote PowerShell session associated with that user account. For more information, see To manage PowerShell Remote sessions.

This section also contains the following topics:

For sample code that uses the BITS interfaces, see BITS Samples and Tools.

Using Windows PowerShell to Create BITS Transfer Jobs

You can use PowerShell cmdlets to create synchronous and asynchronous Background Intelligent Transfer Service (BITS) transfer jobs.

All of the examples in this topic use the Start-BitsTransfer cmdlet. To use the cmdlet, be sure to import the module first. To install the module, run the following command: Import-Module BitsTransfer. For more information, type Get-Help Start-BitsTransfer at the PowerShell prompt.

When you use *-BitsTransfer cmdlets from within a process that runs in a noninteractive context, such as a Windows service, you may not be able to add files to BITS jobs, which can result in a suspended state. For the job to proceed, the identity that was used to create a transfer job must be logged on. For example, when creating a BITS job in a PowerShell script that was executed as a Task Scheduler job, the BITS transfer will never complete unless the Task Scheduler’s task setting «Run only when user is logged on» is enabled.

Читайте также:  Ошибка виртуал бокс линукс

To create a synchronous BITS transfer job

The grave-accent character (`) is used to indicate a line break.

In the preceding example, the local and remote names of the file are specified in the Source and Destination parameters, respectively. The command prompt returns when the file transfer is complete or when it enters an error state.

The default transfer type is Download. When you upload files to an HTTP location, the TransferType parameter must be set to Upload.

Because parameter position is enforced for the Start-BitsTransfer cmdlet, the parameter names do not need to be specified for the Source and Destination parameters. Therefore, this command can be simplified as follows.

To create a synchronous BITS transfer job with multiple files

In the preceding example, the Start-BitsTransfer command creates a new BITS transfer job. All of the files are added to this job and transferred sequentially to the client.

The destination path cannot use wildcard characters. The destination path supports relative directories, root paths, or implicit directories (that is, the current directory). Destination files cannot be renamed by using a wildcard character. Additionally, HTTP and HTTPS URLs do not work with wildcards. Wildcards are only valid for UNC paths and local directories.

To create a synchronous BITS transfer job and specify credentials for a remote server

In the preceding example, a user creates a BITS transfer job to download a file from a server that requires authentication. The user is prompted for credentials, and the Credential parameter passes a credential object to the Start-BitsTransfer cmdlet. The user sets an explicit proxy, and the BITS transfer job uses only the proxies that are defined by the ProxyList parameter. The DisplayName parameter gives the BITS transfer job a unique display name.

To create a synchronous BITS transfer job from a CSV file

The «|» is the pipe character.

In the preceding example, a user creates a BITS transfer job that uploads multiple files from a client. The Import-CSV cmdlet imports the source and destination file locations and pipes them to the Start-BitsTransfer command. The Start-BitsTransfer command creates a new BITS transfer job for each file, adds the files to the job, and then transfers them sequentially to the server.

The contents of the Filelist.txt file should be in the following format:

To create an asynchronous BITS transfer job

In the preceding example, the BITS transfer job was assigned to the $Job variable. The files are downloaded sequentially. After the transfer job is complete, the files are immediately available. If $Job.JobState returns «Transferred», the $Job object is sent to the Complete-BitsTransfer cmdlet.

If $Job.JobState returns «Error», the $Job object is sent to the Format-List cmdlet to list the errors.

To manage PowerShell Remote sessions

Starting with WindowsВ 10, version 1607, you can run PowerShell Cmdlets, BITSAdmin, or other applications that use the BITSВ interfaces from a PowerShell Remote command line connected to another machine (physical or virtual). This capability is not available when using a PowerShell Direct command line to a virtual machine on the same physical machine, and it is not available when using WinRM cmdlets.

A BITS Job created from a Remote PowerShell session runs under that session’s user account context and will only make progress when there is at least one active local logon session or Remote PowerShell session associated with that user account. You can use PowerShell’s persistent PSSessions to run remote commands without the need to keep a PowerShell window open for each job to continue making progress, as described in PowerShell Basics: Remote Management.

  • New-PSSession creates a persistent Remote PowerShell session. Once created, the PSSession objects persist in the remote machine until explicitly deleted. Any BITS jobs initiated in an active session will make progress transferring data, even after the client has disconnected from the session.
  • Disconnect-PSSession disconnects the client machine from a Remote PowerShell session and the session’s state continues to be maintained by the remote machine. Most importantly, the remote session’s processes will continue executing, and BITS jobs will continue to make progress. The client machine can even reboot and/or turn off after calling Disconnect-PSSession.
  • Connect-PSSession re-connects the client machine to an active Remote PowerShell session.
  • Remove-PSSession tears down a Remote PowerShell session.
Читайте также:  Лицензионной windows не существует

The example below shows how to use PowerShell Remote to work with asynchronous BITS transfer jobs in a way that allows the job to continue to make progress even when you are not actively connected to the remote session.

bitsadmin examples

The following examples show how to use the bitsadmin tool to perform the most common tasks.

Transfer a file

To create a job, add files, activate the job in the transfer queue, and to complete the job:

bitsadmin /transfer myDownloadJob /download /priority normal https://downloadsrv/10mb.zip c:\\10mb.zip

BITSAdmin continues to show progress information in the MS-DOS window until the transfer completes or an error occurs.

Create a download job

To create a download job named myDownloadJob:

BITSAdmin returns a GUID that uniquely identifies the job. Use the GUID or job name in subsequent calls. The following text is sample output.

Sample output

Add files to the download job

To add a file to the job:

Repeat this call for each file you want to add. If multiple jobs use myDownloadJob as their name, you must use the job’s GUID to uniquely identify it for completion.

Activate the download job

After you create a new job, BITS automatically suspends the job. To activate the job in the transfer queue:

If multiple jobs use myDownloadJob as their name, you must use the job’s GUID to uniquely identify it for completion.

Determine the progress of the download job

The /info switch returns the state of the job and the number of files and bytes transferred. When the state is shown as TRANSFERRED , it means that BITS has successfully transferred all files in the job. You can also add the /verbose argument to get complete details of the job, and /list or /monitor to get all the jobs in the transfer queue.

To return the state of the job:

If multiple jobs use myDownloadJob as their name, you must use the job’s GUID to uniquely identify it for completion.

Complete the download job

To complete the job after the state changes to TRANSFERRED :

You must run the /complete switch before the files in the job become available. If multiple jobs use myDownloadJob as their name, you must use the job’s GUID to uniquely identify it for completion.

Monitor jobs in the transfer queue using the /list switch

To return the state of the job and the number of files and bytes transferred for all jobs in the transfer queue:

Sample output

Monitor jobs in the transfer queue using the /monitor switch

To return the state of the job and the number of files and bytes transferred for all jobs in the transfer queue, refreshing the data every 5 seconds:

To stop the refresh, press CTRL+C.

Sample output

Monitor jobs in the transfer queue using the /info switch

To return the state of the job and the number of files and bytes transferred:

Sample output

Delete jobs from the transfer queue

To remove all jobs from the transfer queue, use the /reset switch:

Оцените статью