I'm having some issues with trying to install various programs via powershell. This is an example (trimmed down) of the component of the module I've built:
Function TEST-INSTALL-Scripts
{
Param($basepath,$Arguments)
$command = @"
cmd.exe /C msiexec /package `"$basepath`" $Arguments
"@
Invoke-Expression -Command $command
}
When I try to invoke it via
Invoke-Command -Session $session -ScriptBlock {TEST-INSTALL-Scripts -Basepath $basepath -Arguments $args}
The command doesn't seem to do anything so I tried using a PSRemote tab to try to get some more details and I used this command:
$basepath = "\\$Server\d$\Files\Install\3rd Party\SQL Server Native Client\sqlncli_x64.msi"
$Arguments = ' /quiet /passive'
TEST-INSTALL-Scripts -basepath $basepath -Arguments $Arguments
And I get a response back saying the file cannot be accessed or its not a valid file.
T h i s i n s t a l l a t i o n p a c k a g e c o u l d n o t b e o p e n e d . V e r i f y t h a t t h e p a c k a g e e x i s t s a n d t h a t y o u c a n a c c e s s i t , o r c o n t a c t t h e a p p l i c a t i o n v e n d o r t o v e r i f y t h a t t h i s i s a v a l i d W i n d o w s I n s t a l l e r p a c k a g e .
When I RDP onto the machine itself, the exact same command works without any issue.
My research is pointing toward this being a double hop issue, but short of copying the file to the machine, is there a way of dealing with this that isn't a nightmare?