Powershell start-process with -wait while running as administrator

justjeffindc

New member
Local time
6:31 AM
Messages
28
I need to be able to start a process and have it wait for the process to complete. For example, if I run the below:

start-process notepad -wait
[System.Windows.Forms.MessageBox]::Show("Started running.")

Notepad opens, and after I close it the message box pops up. This is exactly what I want to see except that the process I actually need to run needs to run as administrator. So I run this instead:

start-process notepad -verb runAs -wait
[System.Windows.Forms.MessageBox]::Show("Started running.")

Now Notepad opens and the message displays immediately.

What am I doing wrong?
 

My Computer

Computer Manufacturer/Model Number
Homebuilt
OS
Windows 7 Professional 64 bit

My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Back
Top