Kaseya Community

Managing GPO via Kaseya

This question is not answered

hi,

It is possible to create GPO Policies via kaseya agent procedure?

I've tried to run a command via Powershell 

New-GPO -Name SampleGPO -comment "This is a test via PS." ----- it will create  a new gpo

Set-GPRegistryValue -Name "SampleGPO" -key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -ValueName ScreenSaveTimeOut -Type DWORD -value 900 ------ assign a sample GPO policy via registry. 

new-gplink -name SampleGPO -target "dc=nmitestdomain,dc=com" ----- link the policy to a domain 

Is there a way to run this commands via kaseya agent procedure? I've tried the executePowershell command but its not working.

And can I create GPO policies that are not RegistryBased? via Powershell or any commands or scripts?

Our objective of developing this kind of script is to have a single console policy management and for easy management.. 

Thanks!

All Replies
  • Hi ,

    Have you tried with the Execute Powershell Command 64bits ? You should do a ps1 to set your GPO then execute it, but if you are using the New-GPO on 2008 R2 you must create a function to load the powershell AD module in start of your script like :

    1. Function Import-ActiveDirectory{  
    2. <#  
    3.    .SYNOPSIS   
    4.    Test the Active Directory Module  
    5.    .DESCRIPTION  
    6.    Test the Active Directory Module is Available or loaded,  
    7.    if not avaible, it's call a break, 
    8.    if it's loaded it's do nothing  
    9.    .EXAMPLE   
    10.    Import-ActiveDirectory  
    11.      .NOTES   
    12.     NAME: Import-ActiveDirectory  
    13.     AUTHOR: Etienne Deneuve  
    14.     LASTEDIT: 02/18/2013 10:31:35   
    15.     KEYWORDS: Active Directory, Import-Module  
    16.    .LINK   
    17.     Http://www.etiennedeneuve.fr  
    18. #>  
    19.         if((Get-Module ActiveDirectory -ListAvailable).Equals.IsInstance -eq $true){  
    20.             $env:ADPS_LoadDefaultDrive = 0  
    21.             Import-Module ActiveDirectory  
    22.             Write-Host  -fore green "The Active Directory is loaded"  
    23.             }else{  
    24.             Write-Host -fore red "Error while loading the module, are you on a DC ?"   
    25.             break  
    26.             }  
    27. }  
  • hi Etienne,

    Thanks for the reply. actually I'm new in Powershell scripting :). Like what you have said, i need to save my powershell script to .ps1, right? and let kaseya execute the .ps1 file I've already created one but i wasn't able to execute it using kaseya.... :P i'm working with that now..

    another question.. is it possible to edit GPO policy via powershell for example password settings, proxy settings? and not just only on registry based policy.

    Thanks :)