samedi 11 juin 2016

If statement assistance for powershell beginner

Right now I have a powershell script that launches Lync and then Skype for business after test-path to see if it exists. I'm trying to add the below into a larger if statement so it will run the lync portion and then only run the office communicator portion if lync doesn't exist. I've tried this a few different ways and failed. Can anyone assist?

if (Test-Path 'C:\Program Files (x86)\Microsoft Office\office15\lync.exe'){

Start-Process 'C:\Program Files (x86)\Microsoft Office\office15\lync.exe'
} Else {
write-host "Lync is not installed"}


if (Test-Path 'C:\Program Files (x86)\Microsoft Office Communicator'){

Start-Process 'C:\Program Files (x86)\Microsoft Office Communicator\communicator.exe'
} Else {
write-host "Communicator is not installed"}

Aucun commentaire:

Enregistrer un commentaire