Hi there ,<\/p>\n
IM trying to find the following …<\/p>\n
I need a script that … When run it on machine, it checks for visual studio 2015version (14.0.24215.1). if it is installed then it installs setup file on local machine for example c:\\app\\setup.exe.
\nif it is not installed then installs visual studio and then go for setup.exe.
\nalso setup.exe runs with different parameters for each machine.
\nwe have a text file on dfs share like below
\n101 param 1 param2
\n102 param3 param4<\/p>\n
so if I run on pc name ABS101, it should go through the text file and when 101 matches setup.exe runs with the parameters next to 101.<\/p>","upvoteCount":3,"answerCount":79,"datePublished":"2018-04-24T00:14:54.000Z","author":{"@type":"Person","name":"tkr99","url":"https://community.spiceworks.com/u/tkr99"},"acceptedAnswer":{"@type":"Answer","text":"
that works, so…<\/p>\n
$current_pc = 'PASW7d-5RTDES1'\n$current_pc.Substring(0,3)\n<\/code><\/pre>\n$_.branch could be an integer, and you are trying to compare that to a string?<\/p>","upvoteCount":0,"datePublished":"2018-05-14T21:10:32.000Z","url":"https://community.spiceworks.com/t/vbscript-or-powershell-to-install-application/647855/68","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},"suggestedAnswer":[{"@type":"Answer","text":"
try like so<\/p>\n
$machineParams = Import-CSV $filePath | \nwhere {$_.machineCode -eq \"$($env:computername.Substring(3))\"} | select param1, param2\n\n$machineParams\n\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2018-04-24T15:46:03.000Z","url":"https://community.spiceworks.com/t/vbscript-or-powershell-to-install-application/647855/10","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"thanks neally,<\/p>\n
when I run that there is no error,
<\/p>\n
How it will go for next command<\/p>\n
$fileLocation = “C:\\Program Files (x86)\\Microsoft Visual Studio\\2015\\IDE\\devenv.exe”<\/p>\n
if (Test-Path $fileLocation){<\/p>","upvoteCount":0,"datePublished":"2018-04-24T16:26:51.000Z","url":"https://community.spiceworks.com/t/vbscript-or-powershell-to-install-application/647855/11","author":{"@type":"Person","name":"tkr99","url":"https://community.spiceworks.com/u/tkr99"}},{"@type":"Answer","text":"
You have to tell it the location<\/p>\n
$filePath = \"$env:userprofile\\desktop\\test.csv\"\n$machineParams = Import-CSV $filePath | \nwhere {$_.machineCode -eq \"$($env:computername.Substring(3))\"} | select param1, param2\n$machineParams\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2018-04-24T16:33:08.000Z","url":"https://community.spiceworks.com/t/vbscript-or-powershell-to-install-application/647855/12","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"