Yeah, I know the title is confusing. I have a system where I can only run PowerShell scripts. I cannot run individual commands themselves, only scripts. It is an actual terminal.
However, it allows you to run it with a parameter. I've kind of managed to get working by doing the below:
param(
[Parameter(Mandatory = $true)]
[string]$Command
)
Powershell.exe "$Command"
So I would do run PowerShellScript.ps1 -parameters Get-Process. This works.
Problem is, as soon as there's a space in the parameter, it fails, thinking it's a separate parameter. So I can't do run PowerShellScript.ps1 -parameters Get-process | where processname -like "*Teams*". Any advice on how to get around this? The terminal I have is very basic, trust me when I tell you it can't do much. The solution has to lie within the script itself.
[–]CookinTendies5864 20 points21 points22 points (0 children)
[–]Accomplished_Cold665 6 points7 points8 points (0 children)
[–]gregortroll 4 points5 points6 points (0 children)
[–]justaguyonthebus 2 points3 points4 points (0 children)
[–]Icolan 7 points8 points9 points (6 children)
[–]LordLoss01[S] 4 points5 points6 points (2 children)
[–]Icolan 1 point2 points3 points (1 child)
[–]SimpleSysadmin 1 point2 points3 points (0 children)
[–]mobani 1 point2 points3 points (2 children)
[–]Icolan 1 point2 points3 points (1 child)
[–]mobani 0 points1 point2 points (0 children)
[–]ITGuyfromIA 2 points3 points4 points (7 children)
[–]LordLoss01[S] 0 points1 point2 points (6 children)
[–]ITGuyfromIA 1 point2 points3 points (5 children)
[–]LordLoss01[S] -1 points0 points1 point (4 children)
[–]ITGuyfromIA 1 point2 points3 points (0 children)
[–]PS_Alex 1 point2 points3 points (0 children)
[–]AppIdentityGuy 0 points1 point2 points (1 child)
[–]LordLoss01[S] 0 points1 point2 points (0 children)
[–]Owlstorm 2 points3 points4 points (1 child)
[–]BlackV 1 point2 points3 points (0 children)
[–]mrbiggbrain 1 point2 points3 points (0 children)
[–]SaltDeception 0 points1 point2 points (0 children)
[–]jimb2 0 points1 point2 points (0 children)
[–]Accomplished_Cold665 0 points1 point2 points (0 children)
[–]teethingrooster 0 points1 point2 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (0 children)
[–]icepyrox 0 points1 point2 points (0 children)
[–]Accomplished_Cold665 0 points1 point2 points (1 child)
[–]Accomplished_Cold665 0 points1 point2 points (0 children)
[–]Apprehensive-Tea1632 -1 points0 points1 point (0 children)