Install step to check if user is logged on

Comments

3 comments

  • Erik Curtis

    Can I use PowerShell like this and exit is $UserName = Null

    $UserName = (Get-WmiObject  -Namespace root\cimv2 -Class Win32_ComputerSystem).UserName

    0
    Comment actions Permalink
  • Luke Nichols

    Erik,

    You could probably solve this with PowerShell but here is a simpler way. Go to "Step 3- Kill Java Processes" and go to the Conditions tab. Change "Logged On State" to "Only run if no user is logged on." Go to the Options tab and change the "Error Mode" to "Stop Deployment with Error"

     

    I would advise against modifying steps 1 or 2-- you don't want to set them to stop the deployment on a failure since they will fail on machines that don't have 32/64 bit Java. It's also harmless to run those steps if a user is logged in since they only read a reg value-- they don't actually do anything disruptive to the user. You could create a new step as the first step in the package and set the above options there, though.

    1
    Comment actions Permalink
  • Erik Curtis

    I found that I can add a Powershell Step as Step1 and set Error Mode within the Options tab to stop on error

     

    $UserName = (Get-WmiObject -Namespace root\cimv2 -Class Win32_ComputerSystem).UserName
    If($UserName){
    exit 100
    }
    Else{
    exit 0
    }

    1
    Comment actions Permalink

Please sign in to leave a comment.