r/LearnPowerShell • u/youkoflame • Jul 24 '20
Call another script as an administrator
Hello,
I am currently attempting to use one script to install a program. Once the program installs I have to invoke another script as an administrator to copy a file from C:\Users\Public to C:\Programs x86.
Currently I have tried the line:
Start-Process powershell.exe -Verb RunAs -ArgumentList -File "C:\Users\Public\TmReg.ps1"
This is supposed to run the following command in a separate script:
copy-item -Path "C:\Users\Public\TmReg.ini" -Destination "C:\Program Files (x86)\TeamMate\Bin"
But this is not working and the file remains in the Public folder. Could someone ELI5 how to call another script from my current script?
View all comments
3
u/BetrayedMilk Jul 26 '20
Instead of running
Start-Process, does something like this work?