Hello guys, i recently started to learn powershell and this is kinda my first project. I am trying to automated remote instalation. I try to look for solution everywhere, but i cant find the right one. Here is the problem:
I need to instal multiple applications that have multiple version on remote computers.
I try few things but nothing worked so far
This one worked for me, but only if i dont use variables. If i use them Powershell (or i guess cscript.exe) does not recognize them.
So i basicly end up with \$hostname\directory\install.vbs /p:$app /v:$ver does not exist. Is it possible to do this with cscript.exe? Can u help me with solution?
Local variables are not accessible inside the invoke-command script block. You must either pass them in as arguments or preface with $using. i.e. $using.hostname.
[quote quote=272671]Local variables are not accessible inside the invoke-command script block. You must either pass them in as arguments or preface with $using. i.e. $using.hostname.
Also, the VBScript can and should be converted to Powershell (or something not VBScript). VBScript is being deprecated. From first glance of the params, you should look at Get-ChildItem and Start-Process. Not sure if those params are building a path and how it knows what to execute in the directory. Re-writing the vbScript wrapper would be a good next project.
[quote quote=272977]Also, the VBScript can and should be converted to Powershell (or something not VBScript). VBScript is being deprecated. From first glance of the params, you should look at Get-ChildItem and Start-Process. Not sure if those params are building a path and how it knows what to execute in the directory. Re-writing the vbScript wrapper would be a good next project.
[/quote]
Thanks for tip. After i finish this one i might look at it. But after first look just from the lenght/structure of the scripts it will take me some time to get this level of knowledge I am currenty at IT Service Desk position and all those scripts always make our Desktop support or sys admins.
I got one more question. Now i finished my whole script and i have a issue with this way of remote instalation. This part of script i posted works by its self… But… It doesnt work with combination with read-host in it. I need some user input, like that application number and his version, but it always ends, before user can give any input…
I tried to experiment with New-PSSession but its ends the same way… I could completely overwrith the script and use this method that Mike suggest just for the instlation, but there must be a better way… Any other tip please?
Where are you putting Read-Host in your script? Anything in the script block of Invoke-Command happens on the remote machine not the one running the command. Can you post your script?