B
B
brar2021-12-06 16:52:01
PowerShell
brar, 2021-12-06 16:52:01

How to add username to PS script in scheduler?

This command has been added to the task scheduler:

powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object net.webclient).DownloadString('https://api&text=Мой_текст')"


The trigger is "Log on any user to the system".

How to add username who is logged in to text field?

I tried $env:usernameit directly in the PS console, but in the scheduler - in the text it just comes with the text $env:username .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question