Coder Social home page Coder Social logo

Comments (7)

mmashwani avatar mmashwani commented on July 29, 2024

Please post code in code blocks so it's easier to read. You can do so by surround the code block with three back ticks before and after (I edited your post to add the code block).

Refresh-Desktop will refresh desktop icons and also update the environment block for Windows Explorer so that new processes that are spawned reflect the newly created environment variables. Processes load environment variables at initial start and then it is impossible to update the environment block for that process unless you restart the process. If you need to use an environment variable you just created in the same process that created it, then make a call to Refresh-SessionEnvironmentVariables.

from psappdeploytoolkit.

mmashwani avatar mmashwani commented on July 29, 2024

Please explain in detail what behaviour you notice when using the custom code you posted above vs the behaviour you notice when you use the code in the toolkit. That will give me a better understanding of the issue and what I need to fix.

from psappdeploytoolkit.

appPackager avatar appPackager commented on July 29, 2024

Perform your test as follows:

  1. Open Regedit and change the PATH value located at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment;Path
  2. Open a command prompt and type SET. Note the value for PATH. It will not reflect your change.
  3. Run Refresh-Desktop
  4. Open a new command prompt and type SET. Note the value still reflects the value you saw in step #2.
  5. Run Refresh-GlobalEnvironment
  6. Open a new command prompt and type SET. Note the value for PATH now reflects the change you made in step 1.

from psappdeploytoolkit.

appPackager avatar appPackager commented on July 29, 2024

The change required to resolve the issue is to make the following change to AppDeployToolkitMain.cs:
new:

public static void RefreshDesktopAndEnvironmentVariables()
        {
            // Update desktop icons
            SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
            // Update environment variables
            SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, "Environment", SMTO_ABORTIFHUNG, 100, IntPtr.Zero);
        }

old:

public static void RefreshDesktopAndEnvironmentVariables()
        {
            // Update desktop icons
            SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
            // Update environment variables
            SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, null, SMTO_ABORTIFHUNG, 100, IntPtr.Zero);
        }

from psappdeploytoolkit.

mmashwani avatar mmashwani commented on July 29, 2024

Thanks for the update. I've implemented the fix in the latest beta.

from psappdeploytoolkit.

twahab avatar twahab commented on July 29, 2024

Hello, we are running version 3.8.1 of the toolkit and seen where the explorer.exe process is stopped during the installation step using Execute-Msi function. It sounds to me it's happening during the [Installation] :: Refresh the Desktop and the Windows Explorer environment process block. Update-Desktop 8/6/2020 3:51:08 PM 16600 (0x40D8) Step. The package completes running to post-installation step, however then user has to sign in and out to get explorer back or launch taskmgr and initiate explorer.exe. Would appreciate any feedback, thanks

from psappdeploytoolkit.

Garg0yle216 avatar Garg0yle216 commented on July 29, 2024

The package completes running to post-installation step, however then user has to sign in and out to get explorer back or launch taskmgr and initiate explorer.exe. Would appreciate any feedback, thanks

I am using 3.8.4 and I started receiving this same issue in about March 2022. Did you ever get a response on this?

from psappdeploytoolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.