That_annoying_guy

//That_annoying_guy
That_annoying_guy

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • That_annoying_guy
    Participant
    Post count: 42

    RE: Is it possible from Inside the script to detect if the session posh session is 32 or 64 bits?
    $envOSArchitecture

    RE: I would like to show a w[i]ndows to ask the user to close his session with a[n] ok button. So I tried a Show-dialogbox but in the logs I am seeing a session 0 is active and then the Window is not showing.
    Show-InstallationPrompt

    RE: We are using the latest PSADTK 3.6.8
    3.6.8 is getting old. I don’t use it. I use this: https://github.com/PSAppDeployToolkit/PSAppDeployToolkit

    serviceUI might help you get around your “No GUI allowed in session 0” issue but it’s not well documented or officially supported. I’ve seen other posts about how to use it but I have never bothered to use it.

  • That_annoying_guy
    Participant
    Post count: 42

    YES!

    Elevation creates 2 security contexts: Regular and elevated.

    Only administrators get 2 security tokens.
    When you map drive letters they are mapped using only ONE token.

    Drive mappings are Per-user.

    Usually drive letters are mapped centrally with a login script.
    That way, you do not have to visit every box when you change which server was serving the share(s) for those drive letters.

  • That_annoying_guy
    Participant
    Post count: 42

    Known new-psdrive issue.
    See https://stackoverflow.com/questions/32865461/new-psdrive-persist-doesnt-work#32867280

    When logged in as administrator, drive mappings are also Elevation-specific.
    mapped drives while being elevated won’t exist when not elevated.

    PS: Please don’t post as bug and ask for help at the same time.

  • That_annoying_guy
    Participant
    Post count: 42

    We usually make each package uninstall all previous versions of itself.
    The logic is all self-contained. Otherwise we would need to keep 100+ package for flash on the network.

  • That_annoying_guy
    Participant
    Post count: 42

    FYI: autocomplete works in PowerGui if you run debug on Deploy-Application.ps1 once or at least to the point right after loading AppDeployToolkitMain.ps1.

    I do this all the time. No having to remember all the parameters of every function is a godsend.

  • That_annoying_guy
    Participant
    Post count: 42
  • That_annoying_guy
    Participant
    Post count: 42

    I can’t reproduce the UAC prompt with reg.exe import <path to .reg file>
    I tried on 3 computers in 3 different environments.

    In one of our environments REG/Regedit is disabled for normal users but no UAC prompt.
    So we usually launch a WiseScript exe that does registry the changes.

    I’m sorry. I can’t help you.
    You must find a way that a regular user can change their HKCU and use that in ActiveSetup.

  • That_annoying_guy
    Participant
    Post count: 42

    None support .reg files directly and there is no converter at this time.

    Set-RegistryKey affects one registry value at a time. In your case, if you have HKEY_LOCAL_MACHINE entries in your REG file, you must use this at install time.

    ActiveSetup is a built-in feature of Windows that triggers an EXE to make per-user changes when a user logs in. The EXE is triggered ONCE and delays the showing of the desktop until it is done or fails. If it fail you will get no error message. If the EXE hangs or takes a long time to finish, you will think your computer is hung. Set-ActiveSetup creates the required registry keys in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components” to make ActiveSetup to work. When a user logs in, the OS reads those sub-keys and creates a matching key name in “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components”.

    In your case, that EXE is REG.exe and you give reg.exe parameters. Just make sure that a regular user has the permissions to make those changes. The EXE file (and reg file in your case) must be reachable when the user logs in. If the regular user cannot run/read the file, it will fail. So a more complete code sample would be:

    <code>#Copy the REG file on the machine
    Copy-File -Path &quot;$dirFiles\PSAppDeployHKCUSettings.reg&quot; -Destination &quot;$envProgramFilesX86\PS App Deploy\PSAppDeployHKCUSettings.reg&quot; -ContinueOnError $false
    #prepare ActiveSetup
    Set-ActiveSetup -StubExePath &quot;$envSystem32Directory\reg.exe&quot; -Arguments &quot;import &lt;code&gt;&amp;quot;$envProgramFilesX86\PS App Deploy\PSAppDeployHKCUSettings.reg&lt;/code&gt;&quot;&quot; -Description &#039;PS App Deploy Config&#039; -Key &#039;PS_App_Deploy_Config&#039; -ContinueOnError $true</code>

    Invoke-HKCURegistrySettingsForAllUsers take a more aggressive way of doing per-user changes. It locates all NTUSER.DAT files (Each user’s HKCU) and forces the changes in at install time. For future users, it modifies the Default user profile. I don’t like this route because I see it as pollutes the Default user profile. You could, in theory, make a change that makes new user profiles unusable.

    The PSAppDeploymentToolkitAdminGuide.docx does mention some of this but it assumes you know what ActiveSetup is and how it works.

  • That_annoying_guy
    Participant
    Post count: 42

    Sorry, I meant something like this:

    Set-ActiveSetup -StubExePath “$envSystem32Directory\reg.exe” -Arguments “import "%SystemDrive%\Program Files (x86)\PS App Deploy\PSAppDeployHKCUSettings.reg“” -Description ‘PS App Deploy Config’ -Key ‘PS_App_Deploy_Config’ -ContinueOnError $true

    I took original from the .EXAMPLE in the Set-ActiveSetup. I will have to ask the Developers to update it.

    The catch is that your REG file can only have entries for HKEY_CURRENT_USER. If you have HKEY_LOCAL_MACHINE entries in your REG file, they must be separated and imported during the install of the program.

  • That_annoying_guy
    Participant
    Post count: 42

    I tried and got this:

    <code>...
    [07-28-2016 12:11:36.410] [Initialization] [Execute-Process] :: [C:\temp\something.exe] is a valid fully qualified path, continue.
    [07-28-2016 12:11:36.445] [Initialization] [Execute-Process] :: Function failed, setting exit code to [60002]. 
    Error Record:
    -------------
    
    Message        : File [C:\temp\something.exe] not found.
    InnerException : 
    
    FullyQualifiedErrorId : File [C:\temp\something.exe] not found.
    ScriptStackTrace      : at Execute-Process&lt;Process&gt;, C:\&lt;path&gt;\PSADT_v3.6.9_Beta\AppDeployToolkit\AppDeployToolkitMain.ps1: line 2766
                            at &lt;ScriptBlock&gt;, C:\Users\UserName\AppData\Local\Temp\e3523fab-7a02-476f-8eee-0f3ddae37418.ps1: line 2
                            at &lt;ScriptBlock&gt;, &lt;No file&gt;: line 1
    
    PositionMessage : At C:\&lt;path&gt;\PSADT_v3.6.9_Beta\AppDeployToolkit\AppDeployToolkitMain.ps1:2766 char:6
                      +                     Throw &quot;File [$Path] not found.&quot;
                      +                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    [07-28-2016 12:11:36.460] [Initialization] [Exit-Script] :: Deploy-Application_v1r1 Installation completed with exit code [60002].
    [07-28-2016 12:11:36.475] [Initialization] [Test-PowerPoint] :: Check if PowerPoint is in either fullscreen slideshow mode or presentation mode...
    [07-28-2016 12:11:36.486] [Initialization] [Test-PowerPoint] :: PowerPoint application is not running.
    [07-28-2016 12:11:36.493] [Initialization] [Test-PowerPoint] :: PowerPoint is running in fullscreen mode [False].
    [07-28-2016 12:11:36.504] [Initialization] [Show-BalloonTip] :: Display balloon tip notification with message [Installation failed.].
    ...</code>

    Try to give it a REAL file to look at. Make it a 0 byte file.

  • That_annoying_guy
    Participant
    Post count: 42

    I think I’m going to need more info like where are you placing this Execute-Process line in Deploy-Applications.ps1

    Maybe the Execute-Process line itself, too.

  • That_annoying_guy
    Participant
    Post count: 42

    I don’t use it but here’s my guess:

    [String]$MyButtonText = “click here to do stuff”
    [String]$result = Show-InstallationPrompt -ButtonRightText $MyButtonText …<more params> …

    If ($result -eq $MyButtonText) {
    Write-log “He pressed it”
    } Else {
    Write-log “He did something else”
    }

  • That_annoying_guy
    Participant
    Post count: 42

    Then your original idea should work UNLESS the error happens before Resolve-Error is declared.

    If that is the case, look at the code I proposed in issue 163
    https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/issues/163

  • That_annoying_guy
    Participant
    Post count: 42

    If you get it working (Or not), Ask the developers to add it as an example to Set-RegistryKey.

    I’m impressed you figured out a way to make it work.

  • That_annoying_guy
    Participant
    Post count: 42

    Test-VHD is probably your best bet https://technet.microsoft.com/en-us/library/hh848580.aspx

    I suspect you need to add -ErrorAction ‘Stop’ to ensure you get a terminal error to get ‘Catch’ to work.

Viewing 15 posts - 1 through 15 (of 36 total)