powershellcmdtfs-2015vnext

force kms sync with powershell hangs


I have a command in my script.ps1 which is run by a next build step in tfs 2015. I then navigate to the location of office, run the command to force a KMS push like this:

cmd.exe dir "C:\apps\MSOffice\Office15\"
cmd.exe "cscript ospp.vbs /act"

It gets executed but then it just hangs and nothing happens. If I execute the command by hand it works without problems. This only occurs if I do it through powershell - running the command by hand works as intended.


Solution

  • thanks Micky!, /C helped me debugging.

    solution is like this:

    cmd.exe /c "cd C:\apps\MSOffice\Office15\"
    cmd.exe /c "cscript.exe C:\apps\MSOffice\Office15\ospp.vbs /act"
    

    need to execute the script VB handler separately from the VB script. BTW: the reason why im doing this is because i have a build task that will execute this upon 20 build machines simultaneously.