Answer the question
In order to leave comments, you need to log in
How to run PS script via cmd?
There is a script.
$username = 'логин администратора'
$password = 'пароль'
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
Start-Process -credential $cred -filepath '\\ad\TISert\SysInfo Detector Pro\SysInfoDetector.exe'
@echo off
SetLocal EnableExtensions
For /F "UseBackQ delims=" %%a in (`
%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy ByPass -command ". 'c:\zzz\scr.ps1'"
`) do (
echo %%a
)
pause
Answer the question
In order to leave comments, you need to log in
Use a scheduler. Logging in to the system and running as the specified user are its regular features.
Well, specifying the Administrator's login and password in the clear... This is "best practice"...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question