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

    FOG/Powershell not copying to Win32/GroupPolicy/Adm

    Scheduled Pinned Locked Moved Solved
    FOG Problems
    5
    12
    1.7k
    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.
    • V
      VictorKrazan6267
      last edited by Tom Elliott

      Below is my script. Everything works except the Copy-Item line. I’ve tested copying the files to other locations and it works then. When it comes to copying the file to that location it just doesn’t want to do it. Other things I’ve tried, -path, move-item, took out all environmental variables.

      #Powershell %~dp0
      $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
      
      #installs Chrome
      Start-Process $scriptPath\ChromeInstall.msi /q -wait -WindowStyle hidden
      
      #imports registry!
      Reg import $scriptPath\chrome_settings.reg
      
      #copies over .adm files                                                            
      copy-Item -LiteralPath 'C:\Program Files (x86)\FOG\tmp\ChromePowerShell\chrome.adm' -Destination 'C:\Windows\System32\GroupPolicy\Adm' -Force -Verbose -Recurse
      copy_item -LiteralPath 'C:\Program Files (x86)\FOG\tmp\ChromePowerShell\GoogleUpdate.adm' -Destination 'C:\Windows\System32\GroupPolicy\Adm' -Force -Verbose -Recurse
      
      #force GroupPolicy update
      Start-Process gpupdate /force  -WindowStyle hidden
      #Remove-Item -path 'C:\Program Files (x86)\FOG\tmp\ChromePowerShell'
      

      ** mod edit to distinguish code **

      george1421G V 2 Replies Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        @victorkrazan6267 I see 2 copy items and the second is written copy_item while the first one seems proper syntax of copy-item

        Are both failing?

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        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
        • george1421G
          george1421 Moderator @VictorKrazan6267
          last edited by

          @victorkrazan6267 So I have to ask the question, what permissions are on that directory [C:\Windows\System32\GroupPolicy\Adm] is it owned by the trusted installer? The FOG service runs as the SYSTEM account. Any rights that SYSTEM has, can do the FOG service should do.

          But on a lower level I have to ask why are you doing this? Typically the ADM files are only used on the domain controller or any system that needs to configure the GPO policies. The workstations that consume the policies don’t need the ADM files locally.

          The other comment I would have is to not use the full path to the FOG TMP directory. Use %~dp0 to identify the local path. If for some reason the FOG client is installed in a different directory your script will break.

          Finally I assume you are creating a snapin pack and deploying it that way, that way all of your files are copied over to the target computer.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          V 1 Reply Last reply Reply Quote 0
          • V
            VictorKrazan6267 @george1421
            last edited by

            @george1421 SYSTEM has full permissions. The files are going onto a laptop that will be going out to the field and techs don’t come into the offices often. I did try using $scriptPath, but It still wasn’t copying the files. Yes its in a powershell snapin pack.

            JJ FullmerJ 1 Reply Last reply Reply Quote 0
            • V
              VictorKrazan6267
              last edited by

              @tom-elliott Whoops typo. Yes both are failing.

              Tom ElliottT 1 Reply Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott @VictorKrazan6267
                last edited by

                @victorkrazan6267 and you’re sure ChromePowersShell files exist in the fog\tmp folder?

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                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

                V 1 Reply Last reply Reply Quote 0
                • V
                  VictorKrazan6267 @Tom Elliott
                  last edited by

                  @tom-elliott Yep, went to FOG/tmp to make sure that they were being extracted to ChromePowerShell. If i change -Destination to C:\Users<User>\Desktop the files will be copied to the desktop.

                  1 Reply Last reply Reply Quote 0
                  • Q
                    Quazz Moderator
                    last edited by

                    Does the destination folder actually exist already?

                    V 1 Reply Last reply Reply Quote 0
                    • V
                      VictorKrazan6267 @Quazz
                      last edited by

                      @quazz Yes they do.

                      1 Reply Last reply Reply Quote 0
                      • JJ FullmerJ
                        JJ Fullmer Testers
                        last edited by

                        So this is an idea unrelated to your script syntax
                        Do you have access to your active directory central store and are all the computers involved in AD?
                        Based on what you have written you’re using the adm policy templates for applying chrome policies via group policy that you had set at the AD level.

                        If you copy the admx files to the central store they’ll get copied down to each AD joined computer automatically. Is that an option for you?

                        I believe that the folder you’re copying to has some extra security built into it or something. I remember reading that once upon a time. You can use the chrome.admx file and the googleUpdate.admx files from where you got the adm files and copy them to c:\windows\policyDefinitions and that will work fine. I used to do it that way before I started just including them in the domain central store which can be accessed (read\write) remotely via \\domainControllerHostname\C$\Windows\SYSVOL\sysvol\domainFqdn\Policies\PolicyDefinitions You may have to login to the domain controller and find the local folder of that share.
                        I think you can copy adm files to either the central store or local store too, but I’ve read that admx files are the better option. I can’t remember why but I recall it being convincing.

                        I hope that helps.

                        Have you tried the FogApi powershell module? It's pretty cool IMHO
                        https://github.com/darksidemilk/FogApi
                        https://fogapi.readthedocs.io/en/latest/
                        https://www.powershellgallery.com/packages/FogApi
                        https://forums.fogproject.org/topic/12026/powershell-api-module

                        1 Reply Last reply Reply Quote 1
                        • JJ FullmerJ
                          JJ Fullmer Testers @VictorKrazan6267
                          last edited by

                          @victorkrazan6267 I just read this part after making my domain central store reccomendations.
                          We have some non-domain computers and I utilized copying the admx files to C:\Windows\PolicyDefinitions for setting the policies in local group policies. You could theoretically embed them in your image as well.

                          You can also use the policyfileeditor module https://www.powershellgallery.com/packages/PolicyFileEditor/3.0.1
                          to edit the local group policy as part of that script.

                          i.e. to set chrome to always open pdfs externally you could do

                          $machinePol = "C:\WINDOWS\system32\grouppolicy\machine\Registry.pol";
                          $chromeKey= "Software\policies\google\chrome";
                          
                          Set-PolicyFileEntry $machinePol -key $chromeKey -ValueName "AlwaysOpenPdfExernally" -Data 1 -Type DWord;
                          
                          

                          It takes a little time to learn that module. But it’s pretty useful to have a way to script changes to local group policies.

                          Have you tried the FogApi powershell module? It's pretty cool IMHO
                          https://github.com/darksidemilk/FogApi
                          https://fogapi.readthedocs.io/en/latest/
                          https://www.powershellgallery.com/packages/FogApi
                          https://forums.fogproject.org/topic/12026/powershell-api-module

                          1 Reply Last reply Reply Quote 1
                          • V
                            VictorKrazan6267 @VictorKrazan6267
                            last edited by

                            @Tom-Elliott Tried running the script w/ psexec w/ all files in appropriate locations and it ran w/o an issue doing everything it was supposed to. Unfortunately FOG still doesn’t seem to want to copy those 2 files. GroupPolicy is a hidden folder, could that be causing an issue?

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post

                            153

                            Online

                            12.0k

                            Users

                            17.3k

                            Topics

                            155.2k

                            Posts
                            Copyright © 2012-2024 FOG Project