Solved

Modify local Group Policy through powershell

Posted on 2016-07-25
5
62 Views
Last Modified: 2016-09-05
Hi Everyone,

How can I add and lockdown "logon Script" in Local Group Policy through Powershell or batch script.
0
Comment
Question by:silcom
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Benjamin Voglar
Comment Utility
And what does the script do?

Is this what you are looking for?

https://4sysops.com/archives/configuring-logon-powershell-scripts-with-group-policy/
0
 

Author Comment

by:silcom
Comment Utility
Hi Benjamin,

Script is setting wallpaper and network drive.

My computers are in workgroup and I want to set Local Group policy through Powershell or Command prompt and not GPEDIT.MSC GUI.
0
 
LVL 23

Accepted Solution

by:
Coralon earned 500 total points
Comment Utility
All you have to do is look up the correct registry values and then use your script to place them..

For the logon script, you will copy your script down to whatever location, and then put a reference to it under HKLM\Software\Microsoft\Windows\CurrentVersion\Run
LogonScript = c:\scripts\logonscript.ps1 (REG_SZ)

You can use your login script to set the wallpaper, or you can lookup the registry value for the policy to put in that value.  (There are several places for policy values to go unfortunately.. )

Coralon
0
 
LVL 12

Expert Comment

by:Benjamin Voglar
Comment Utility
Hi.

Make a bat file and copy this into:

@echo off
reg add "HKCU\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f 
reg add "HKCU\control panel\desktop" /v wallpaper /t REG_SZ /d "C:\[LOCATION OF WALLPAPER HERE]" /f 
reg delete "HKCU\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperStyle /f
reg add "HKCU\control panel\desktop" /v WallpaperStyle /t REG_SZ /d 2 /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 

net use s: /Delete
net use s: \\your\share

Exit

Open in new window


How to run a batch file each time the computer boots:

http://www.computerhope.com/issues/ch000322.htm
0
 

Author Closing Comment

by:silcom
Comment Utility
Thanks for the workaround on how to set logon script.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
A procedure for exporting installed hotfix details of remote computers using powershell
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now