I would like to know how I can run remote applications on Windows Machines. Until now I have been using Windows Powershell remote, that works fine, but only to execute cmdlets. I want to be able to execute any command line application, like launch a Vim session, a Diskpart utility, etc.
Home
/
user-47605
mjsr's questions
im making a script like sudo, the idea is that the sudo function is going to run a scriptblock in elevation. I'm having trouble with the strings variables, that i pass in that scriptblock. Is like the doubles quotes disappear. What is wrong with my approach? Here is the code.
function sud([ScriptBlock]$SomeCode){
$here = Get-Location;
Start-Process Powershell -Verb Runas -ArgumentList "-command &{cd $here; $SomeCode}"
}
and i want to run commands like this:
$var ="Path"
$newpath = $env:path + ";c:\somedir"
$target = "Machine"
sud -somecode { [Environment]::SetEnvironmentVariable($var, $newpath, $target)}
for testing purpose one can add the parameter -noexit to the argumentlist..
Start-Process Powershell -Verb Runas -ArgumentList "-noexit","-command &{cd $here; $SomeCode}"
do you know some way to navigate trough windows libraries in Powershell?, exist some provider? it will be nice have this posibility because in libraries i have everything that i need almost in one ore two dir depth when in reality practically all those dirs are four or five+ dir depth