You are not logged in.
Pages: 1
hello
i search to have a list of all process on a Windows computer
with all arguments
like
"c:\Windows\system32\wudfhost.exe" -hostGUID:{193....} -loeventPortName:hostProcess
c:\syst\sinagios\\agent\nsclient\nscp.exe --run
i want all "Command line" in TaskPanel
$arr1=get-process
$arr1 | %{
$proc=$_
$proc | select *
}
thank you
Offline
found !!!
Get-WmiObject -Class WIN32_Process | select commandLine
Offline
Get-WmiObject -Class WIN32_Process | where commandline -NE $null | select ProcessID,Name,commandline > cl3.txt
Offline
Hi
This code show you how we can run a batch script as admin using Powershell in order to manage windows processes in command line and can be run from a batch file like that : Run_As_Admin_PS.bat
@echo off
Mode 90,5
Title Run as admin using Powershell to manage windows Processes in command line by Hackoo 2020
If [%1] NEQ [Admin] Goto RunAsAdmin
Call :CreateShortcut
:Main
Set /a W=400
Mode %W%,%W% & cls & color 0A
Set "MyPID="
REM =================================================================================================
Powershell ^
Get-WmiObject Win32_Process ^
| where commandline -NE $null ^
| Select-Object ProcessID,Name,CommandLine ^
| Out-String -Width %W% ^
| Findstr /I /V "Admin" ^
| Findstr /I /V "Get-WmiObject"
REM The second powershell command is for saving the output result into a text file with same name ;
REM as the script but with ".txt" in extension.
Powershell ^
Get-WmiObject Win32_Process ^
| where commandline -NE $null ^
| Select-Object ProcessID,Name,CommandLine ^
| Out-String -Width %W% ^
| Findstr /I /V "Admin" ^
| Findstr /I /V "Get-WmiObject" ^
| Out-File "%~dpn0.txt" -Encoding ASCII
echo(================================================================================================
SET /P "MyPID=Please enter the Process ID number in order to kill its Application correspondante : "
IF [%MyPID%] EQU [] GOTO Error
cls & echo(
Taskkill /PID %MyPID% /T /F
If ErrorLevel 1 Color 0C
Timeout /T 2 /NoBreak>nul & Goto Main
::---------------------------------------------------------------------------------------------------
:RunAsAdmin
cls & color 0B & Mode 90,5
echo(
echo( ===========================================================
echo( Please wait a while ... Running as Admin ....
echo( ===========================================================
Powershell start -verb runas '%0' Admin & Exit
::---------------------------------------------------------------------------------------------------
:Error
cls & echo( & Color 0C
ECHO You did not enter a PID ????
Timeout /T 2 /NoBreak>nul & Goto Main
::---------------------------------------------------------------------------------------------------
:CreateShortcut
Powershell ^
"$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%\Desktop\%~n0.lnk'); ^
$s.TargetPath='%~f0'; ^
$s.WorkingDirectory='%~dp0'; ^
$s.IconLocation='PowerShell.exe,0'; ^
$s.HotKey='CTRL+ALT+R'; ^
$s.Save()"
Exit /B
::---------------------------------------------------------------------------------------------------
Offline
Pages: 1