• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Problem with snapin and client registery keys

    Scheduled Pinned Locked Moved Solved
    FOG Problems
    register snapins windows 10
    2
    3
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Gerjan
      last edited by

      Server
      • FOG Version: 1.4.4
      • OS: CentOS 7
      Client
      • Service Version: 0.11.12
      • OS: Windows 10
      Description

      I have a problem with a Powershell script.
      I want to add some register keys to all clients. Everything in this Powershell script is working just fine only for the register keys. Snapin task give no errors.
      I have read a article on the internet that the service on the client is running as SYSTEM user.
      How can i do this within a Powershell script?

      Here is some of my register keys within the powershell script.

      New-Item -Path HKCU:\Software\Test -Force
      New-ItemProperty -Path "HKCU:\SOFTWARE\Test" -Name "Machinenummer" -Value $env:computername -PropertyType String -Force | Out-Null
      
      
      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by Sebastian Roth

        @Gerjan HKCU aka HKEY_CURRENT_USER is different depending on the user being logged on to the computer. So trying to set keys or values within a script that is run by the fog-client (as system service) won’t give you the expected outcome I reckon.

        Read this: https://stackoverflow.com/questions/2365367/how-to-access-hkcu-registry-of-currently-logged-on-users-from-a-service as well as https://social.msdn.microsoft.com/Forums/vstudio/en-US/cef6584d-d05e-4510-a7c2-7ab529c303f9/setting-user-registry-keys-hkcu-from-a-local-system-account-service?forum=vcgeneral - there you find some interesting suggestions on how to find logged on users, get their SID or impersonate this users…

        Maybe you could go a different way as well. Snapin places the powershell script into the user’s autorun folder which is executed on logon…

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • G
          Gerjan
          last edited by

          I have tried many ways and it seems that powershell can’t do this or i missed something.

          What i have tried now is to make a snapin pack with psexec.exe and a batch file.
          Also in this batch i can’t write to HKCU.

          I used now the following code to store the key and this works for now. It’s not a nice solutions but it works.

          If anyone can give me the trick to do this in powershell, let me know.

          PsExec.exe -i -s -u %COMPUTERNAME%\%username% -p -nobanner -accepteula -i REG ADD "HKLM\SOFTWARE\Test" /v "Machinenummer" /t REG_SZ /d %COMPUTERNAME% /f
          
          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          195

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project