.net - How to programatically update group policy with C#? i.e. gpupdate /force -


i have several local accounts created @ install time c#. there group policy in turn grants permissions these new accounts.

the problem trying solve how go getting group policy pushed new accounts. without group policy applied application not function.

opening cmd prompt , running gpupdate /force fixes it, need more seamless transition between install time , run time.

that should trick:

    private void updategrouppolicy()     {         fileinfo execfile = new fileinfo("gpupdate.exe");         process proc = new process();         proc.startinfo.windowstyle = processwindowstyle.hidden;         proc.startinfo.filename = execfile.name;         proc.startinfo.arguments = "/force";         proc.start();         //wait gpupdate finish         while (!proc.hasexited)         {             application.doevents();             thread.sleep(100);         }         messagebox.show("update procedure has finished");     } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -