Jump to content


The Flying Carpenter

Established Members
  • Posts

    16
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by The Flying Carpenter

  1. ah !  Thank you so much !!

    i`ve now made changes to my .ps1 so that it will either have succes or failure….instead of having the TS run a task in relation to the returncode of the script adding this code at the end of my script….and it works !

    So now when a user clicks "cancel", the script fails, therefore the TS fails also….and thats what i want. 

    If the user clicks "OK", the scripts is succesful and the TS continues.

    LogWrite "Ending DisplayMessage script... with returncode $ReturnCode"
    
    if ($ReturnCode = OK)
    {exit 0}
    elseif ($ReturnCode = Cancel)
    {exit 1}
    else {
    logWrite("script did not exit with 0, 1 or cancel")
    }

     

  2. Yes, that`s my issue.  The Cancel = error step in the TS is checking to see if the return code is "1" in order to run.  This would mean that the user clicked the "cancel" button in order to deffer the software install.  If the return code is 1, the TS will run "cmd /c exit 1" which will cause the TS to fail.

    My problem is that even if the user clicks "OK" or "Cancel", the return code is always 0...….or maybe it`s the script that is not assigning the ReturnCode value.  I`ve never done anything like this so i`m just trying to piece things together to make it work but no luck so far.

     

    1TS.JPG

    2TS.JPG

  3. Yes, i had it remmed out because i was testing without it but even without it being remmed out, it wasn`t working yesterday.

    I do have a step in my TS that checks for a TS sequence variable of "returncode" and if it`s equal to 1, it runs the command --> cmd /c exit 1  and this command should make the TS fail (that`s what i want) but it doesnt fail and it continues on to the next step of upgrading software even though the user selected to cancel it for now.

     

  4. i`ve got it to the point where the $returncode is good ...meaning if i run it manually, the value is 1 when i click Cancel and 0 when i click OK but how do i send that value back to the task sequence ?

    Here is the lower part of the script:

     

     

    # now show a popup message to the end user
    write-host $title $message 
    [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)
    $box = [Windows.Forms.MessageBox]::Show(“$message”, “$title”, [Windows.Forms.MessageBoxButtons]::OKCancel, [Windows.Forms.MessageBoxIcon]::Information)
    #$tsenv.Value("ReturnCode") = $ReturnCode
    
    Switch ($box) {
       "OK" {
            Write-Host "OK"    
            $ReturnCode = "0"
            Exit 0
        }
        "Cancel" {
            Write-Host "Cancel"
            $ReturnCode = "1"
            Exit 1
            }
    } 
    

     

  5. Niall,

    I have modified the script to have an OK and a Cancel button to give the clients an option to do a Microsoft Office version upgrade.

    How do i capture the response from the popup and use that response in the task sequence ?  ie: if they press OK, task sequence would continu and if they press cancel, task sequence stops and doesn`t perform the next steps(office upgrade).

    Thanks

  6. tried again with -->   if (($OperatingSystem -eq "Microsoft Windows 10 Enterprise") -or ($OperatingSystem -eq "Microsoft Windows 10 Entreprise"))

    Result in the log file is --> This is not an approved operating system for the Windows 10 Ugprade, exiting with code 99, detected: 'Microsoft Windows 10 Entreprise'

    So even though the spelling is exactly the same, it still fails.  It`s OK….Checking for version number only is fine for me.  Computers understand numbers better anyway :-)

  7. i didn`t try it with the If and -or but when i tried it with the french spelling only, the log wrote something like  "did not find windows 10, continuing."  and then obviously didn`t do the upgrade.

    I just checked the PC that i ended up upgrading last friday.  Is it normal that we have to answer a bunch of questions when we first logon ?  Is there a way to remove it ?  Questions like, do you want to use Cortana, do you want to activate localization, do you want to use speach to text.  This is OK for users but not OK for lab computers.

  8. Yes i had found the line 360 but even when i change it to the french word it still didn`t find windows 10 but i don`t know why because when i run "gwmi win32_operationsystem" manually on a computer, the output is exactly as i spell it.

    Anyways, i ended up omiting that section of code and now i`m only looking for the build number and that works.

    I also had to add a few lines at 395 in order to create the reg key HKCU:\software\"company name" because it previously didn`t exist….and if it doesn`t exist, it can`t subtract a deferal count.

    Thank you for your time, i think the changes i made will work for me.

  9. Thanks Niall,  i was in fact using old files...the vbs versions.

    With the PS version, i found an issue though.  we have our windows 10 OS in french so the OS name is diffrent than what you specify at line 361 of the wrapper.ps1.  I ended up omitting those few lines of code to bypass it.

    The problem i have now is that it doesn`t launch the upgrade.hta so the user doesn`t see the popup window to accept.

    Can you point out where exactly the HTA is executed ?  Thank you.

  10. I`m starting to test the use of this method for the second time. This time is to upgrade to 1809.  Some users have reported to me that the defferal count has not been reset to the 8 times i have configured.

    If they defered 2 times during last Windows upgrade, they now have only 6 defferals left.  Some had zero and where forced to do upgrade imediatly.

    Seems to me that the "HKCU\software\windowsnoob  -  NumberOfUpgradeDefers"  is not getting reset after a succesful upgrade.

    How can i fix this ?

     

  11. Good Day Mr Brady,

    Just wanted to let you know that yesterday, i started using this script with a small group and found that the battery / ACpower detection part of the script doesn`t work.

    It was not detecting that the laptop was plugged in even though it was and battery was fully charged.

    I rem`ed out that part of the script to get around it and will tell the users to make sure they are plugged in during the upgrade.

  12. 9 minutes ago, anyweb said:

    it works for me, I\ve tried both the PowerShell and a snippet of vbs code to test for reboot, can you please run it and check what it reports back ?

    reboot required false.PNG

     

    here\s the test script...

     

    checkreboot.vbs

    i get : Reboot Required ? Faux   (our systems are in french).  Then when i click "OK", i get a secound box that says "The Computer needs a reboot".

    Could it be because your script is looking for the word "False"

    1.JPG

  13. On ‎2017‎-‎03‎-‎28 at 5:33 PM, anyweb said:

     

    i was finally able to make this work but only after removing the section in the wrapper.vbs that checked for pending reboot.  For some unknown reason, it always detected that my test system had to be rebooted.

    i also had to remove the section that checked for computer model.  We obviously don`t have the same models and i won`t be deploying it to systems that don`t support Windows 10 anyways.

    Any insight on my first point above would be great though.  Thanks.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.