Hi,
i’m still in the learning wagon about Powershell / scripting and i’m struggling with Function atm…
this is about Installing programm via Powershell with startup Script (Windows server/gpo)
With a “simple” software i do not have the need to use function, and the script work fine.
But with more “complicate” software i sometimes have to install 6-7 “.exe” to make the software usable, that’s why i thought about function…
Base idea was like this :
Function set-IsInstalled { $IsInstalled=0 doregistrycheck, depending on result $IsInstalled=0, 1 or 2 } function Set-Switch { switch ($IsInstalled) { '0' { Start-process $PathExe } '1' { Start-process $UninstallString Start-process $PathExe } '2' { It's Installed } } } function InstallExe1 { $PathExe="\\server\ExeFolder\Setup1.exe" Set-IsInstalled Get-Switch } function InstallExe2 { $PathExe="\\server\ExeFolder\Setup2.exe" Set-IsInstalled Set-Switch } InstallExe1 InstallExe2
but … it just doesn’t work :-/
I get i’m not using the Function properly, could you guide me on “how to do it right” ?