Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Inactive Support Threads
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Software
Security Apps
Hard_Configurator Tools
Applocker on Windows Home.
Message
<blockquote data-quote="Andy Ful" data-source="post: 1011355" data-attributes="member: 32260"><p>The script that creates restrictions looks as follows:</p><p></p><p>[CODE]<#</p><p>.SYNOPSIS</p><p> This function creates new AppLocker settings using MDM WMI Bridge.</p><p> All previous rules will be deleted.</p><p></p><p>.CREDITS</p><p> The script is based on the script for EXE files made by Sandy Zeng (Sandy Tsang).</p><p> https://github.com/sandytsang/MSIntune/tree/master/Intune-PowerShell/AppLocker</p><p>#></p><p></p><p>$namespaceName = "root\cimv2\mdm\dmmap" #Do not change this</p><p>$GroupName = "AppLocker001" #Your own groupName</p><p>$parentID = "./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/$GroupName"</p><p></p><p>$classNameDLL = "MDM_AppLocker_DLL03" #Do not change this</p><p>Get-CimInstance -Namespace $namespaceName -ClassName $classNameDLL -Filter "ParentID=`'$parentID`' and InstanceID='DLL'" | Remove-CimInstance</p><p></p><p>$classNameEXE = "MDM_AppLocker_ApplicationLaunchRestrictions01_EXE03" #Do not change this</p><p>Get-CimInstance -Namespace $namespaceName -ClassName $classNameEXE -Filter "ParentID=`'$parentID`' and InstanceID='EXE'" | Remove-CimInstance</p><p></p><p>$classNameMSI = "MDM_AppLocker_MSI03" #Do not change this</p><p>Get-CimInstance -Namespace $namespaceName -ClassName $classNameMSI -Filter "ParentID=`'$parentID`' and InstanceID='MSI'" | Remove-CimInstance</p><p></p><p>$classNameScript = "MDM_AppLocker_Script03" #Do not change this</p><p>Get-CimInstance -Namespace $namespaceName -ClassName $classNameScript -Filter "ParentID=`'$parentID`' and InstanceID='Script'" | Remove-CimInstance</p><p></p><p>$classNameStoreApps = "MDM_AppLocker_ApplicationLaunchRestrictions01_StoreApps03"</p><p>Get-CimInstance -Namespace $namespaceName -ClassName $classNameStoreApps -Filter "ParentID=`'$parentID`' and InstanceID='Storeapps'" | Remove-CimInstance</p><p></p><p>Add-Type -AssemblyName System.Web</p><p></p><p>#This is example Rule Collection for EXE</p><p>$obj = [System.Net.WebUtility]::HtmlEncode(@"</p><p> <RuleCollection Type="Exe" EnforcementMode="Enabled"></p><p> <FilePathRule Id="921cc481-6e17-4653-8f75-050b80acca20" Name="All files located in the Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%PROGRAMFILES%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePathRule Id="a61c8b2c-a319-4cd0-9690-d2177cad7b51" Name="All files located in the Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%WINDIR%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePublisherRule Id="9ab086ea-40a8-4b05-875b-f9fdf9962ba8" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"></p><p> <BinaryVersionRange LowSection="*" HighSection="*" /></p><p> </FilePublisherCondition></p><p> </Conditions></p><p> </FilePublisherRule></p><p> </RuleCollection></p><p>"@)</p><p>New-CimInstance -Namespace $namespaceName -ClassName $classNameEXE -Property @{ParentID=$parentID;InstanceID="EXE";Policy=$obj}</p><p></p><p></p><p>#This is example Rule Collection for MSI</p><p>$obj = [System.Net.WebUtility]::HtmlEncode(@"</p><p> <RuleCollection Type="Msi" EnforcementMode="Enabled"></p><p> <FilePublisherRule Id="b7af7102-efde-4369-8a89-7a6a392d1473" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"></p><p> <BinaryVersionRange LowSection="0.0.0.0" HighSection="*" /></p><p> </FilePublisherCondition></p><p> </Conditions></p><p> </FilePublisherRule></p><p> <FilePathRule Id="5b290184-345a-4453-b184-45305f6d9a54" Name="All files located in the folder %systemdrive%\Windows\Installer." Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%WINDIR%\Installer\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePathRule Id="64ad46ff-0d71-4fa0-a30b-3f3d30c5433d" Name="Allow for Administrators" Description="" UserOrGroupSid="S-1-5-32-544" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="*.*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> </RuleCollection></p><p>"@)</p><p>New-CimInstance -Namespace $namespaceName -ClassName $classNameMSI -Property @{ParentID=$parentID;InstanceID="MSI";Policy=$obj}</p><p></p><p></p><p>$obj = [System.Net.WebUtility]::HtmlEncode(@"</p><p> <RuleCollection Type="Script" EnforcementMode="Enabled"></p><p> <FilePathRule Id="06dce67b-934c-454f-a263-2515c8796a5d" Name="All scripts in Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%PROGRAMFILES%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePathRule Id="9428c672-5fc3-47f4-808a-a0011f36dd2c" Name="All scripts in Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%WINDIR%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePathRule Id="ed97d0cb-15ff-430f-b82c-8d7832957725" Name="Allow for Administrators" Description="" UserOrGroupSid="S-1-5-32-544" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> </RuleCollection></p><p>"@)</p><p>New-CimInstance -Namespace $namespaceName -ClassName $classNameScript -Property @{ParentID=$parentID;InstanceID="Script";Policy=$obj}</p><p></p><p></p><p>$obj = [System.Net.WebUtility]::HtmlEncode(@"</p><p> <RuleCollection Type="Dll" EnforcementMode="Enabled"></p><p> <FilePathRule Id="bac4b0bf-6f1b-40e8-8627-8545fa89c8b6" Name="All DLLs in Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%WINDIR%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePathRule Id="3737732c-99b7-41d4-9037-9cddfb0de0d0" Name="All DLLs in Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePathCondition Path="%PROGRAMFILES%\*" /></p><p> </Conditions></p><p> </FilePathRule></p><p> <FilePublisherRule Id="1f0d0ec5-8523-4aa0-976a-ad2d2c21eed7" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"></p><p> <BinaryVersionRange LowSection="*" HighSection="*" /></p><p> </FilePublisherCondition></p><p> </Conditions></p><p> </FilePublisherRule></p><p> </RuleCollection></p><p>"@)</p><p>New-CimInstance -Namespace $namespaceName -ClassName $classNameDLL -Property @{ParentID=$parentID;InstanceID="DLL";Policy=$obj}</p><p></p><p></p><p>$obj = [System.Net.WebUtility]::HtmlEncode(@"</p><p> <RuleCollection Type="Appx" EnforcementMode="Enabled"></p><p> <FilePublisherRule Id="a9e18c21-ff8f-43cf-b9fc-db40eed693ba" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"></p><p> <Conditions></p><p> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"></p><p> <BinaryVersionRange LowSection="0.0.0.0" HighSection="*" /></p><p> </FilePublisherCondition></p><p> </Conditions></p><p> </FilePublisherRule></p><p> </RuleCollection></p><p>"@)</p><p>New-CimInstance -Namespace $namespaceName -ClassName $classNameStoreApps -Property @{ParentID=$parentID;InstanceID="Storeapps";Policy=$obj}</p><p>[/CODE]</p><p></p><p><s>WARNING!!!</s></p><p><s><strong><span style="font-size: 15px"><span style="color: rgb(184, 49, 47)">If one would like to modify the script, then please remember to not block PowerShell (powershell.exe).</span></span></strong></s></p><p><s>The restrictions for EXE files (and also DLLs) block also Administrators. So, PowerShell would be blocked even with high privileges and Applocker management would be impossible.</s></p><p><s>The restrictions for PowerShell are for .ps1 files (but Administrators can still run scripts) and Constrained Language Mode.</s></p><p></p><p>PowerShell can be also blocked with administrative rights. The policies do not block processes started from the system shell (with system privileges).</p><p></p><p><strong><span style="color: rgb(184, 49, 47)">Warning!!!</span></strong></p><p><strong><span style="color: rgb(184, 49, 47)">I strongly recommend making a System Restore Point before applying the Applocker rules.</span></strong></p><p></p><p>Post edited/updated.</p></blockquote><p></p>
[QUOTE="Andy Ful, post: 1011355, member: 32260"] The script that creates restrictions looks as follows: [CODE]<# .SYNOPSIS This function creates new AppLocker settings using MDM WMI Bridge. All previous rules will be deleted. .CREDITS The script is based on the script for EXE files made by Sandy Zeng (Sandy Tsang). https://github.com/sandytsang/MSIntune/tree/master/Intune-PowerShell/AppLocker #> $namespaceName = "root\cimv2\mdm\dmmap" #Do not change this $GroupName = "AppLocker001" #Your own groupName $parentID = "./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/$GroupName" $classNameDLL = "MDM_AppLocker_DLL03" #Do not change this Get-CimInstance -Namespace $namespaceName -ClassName $classNameDLL -Filter "ParentID=`'$parentID`' and InstanceID='DLL'" | Remove-CimInstance $classNameEXE = "MDM_AppLocker_ApplicationLaunchRestrictions01_EXE03" #Do not change this Get-CimInstance -Namespace $namespaceName -ClassName $classNameEXE -Filter "ParentID=`'$parentID`' and InstanceID='EXE'" | Remove-CimInstance $classNameMSI = "MDM_AppLocker_MSI03" #Do not change this Get-CimInstance -Namespace $namespaceName -ClassName $classNameMSI -Filter "ParentID=`'$parentID`' and InstanceID='MSI'" | Remove-CimInstance $classNameScript = "MDM_AppLocker_Script03" #Do not change this Get-CimInstance -Namespace $namespaceName -ClassName $classNameScript -Filter "ParentID=`'$parentID`' and InstanceID='Script'" | Remove-CimInstance $classNameStoreApps = "MDM_AppLocker_ApplicationLaunchRestrictions01_StoreApps03" Get-CimInstance -Namespace $namespaceName -ClassName $classNameStoreApps -Filter "ParentID=`'$parentID`' and InstanceID='Storeapps'" | Remove-CimInstance Add-Type -AssemblyName System.Web #This is example Rule Collection for EXE $obj = [System.Net.WebUtility]::HtmlEncode(@" <RuleCollection Type="Exe" EnforcementMode="Enabled"> <FilePathRule Id="921cc481-6e17-4653-8f75-050b80acca20" Name="All files located in the Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%PROGRAMFILES%\*" /> </Conditions> </FilePathRule> <FilePathRule Id="a61c8b2c-a319-4cd0-9690-d2177cad7b51" Name="All files located in the Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%WINDIR%\*" /> </Conditions> </FilePathRule> <FilePublisherRule Id="9ab086ea-40a8-4b05-875b-f9fdf9962ba8" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"> <BinaryVersionRange LowSection="*" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> </RuleCollection> "@) New-CimInstance -Namespace $namespaceName -ClassName $classNameEXE -Property @{ParentID=$parentID;InstanceID="EXE";Policy=$obj} #This is example Rule Collection for MSI $obj = [System.Net.WebUtility]::HtmlEncode(@" <RuleCollection Type="Msi" EnforcementMode="Enabled"> <FilePublisherRule Id="b7af7102-efde-4369-8a89-7a6a392d1473" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"> <BinaryVersionRange LowSection="0.0.0.0" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> <FilePathRule Id="5b290184-345a-4453-b184-45305f6d9a54" Name="All files located in the folder %systemdrive%\Windows\Installer." Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%WINDIR%\Installer\*" /> </Conditions> </FilePathRule> <FilePathRule Id="64ad46ff-0d71-4fa0-a30b-3f3d30c5433d" Name="Allow for Administrators" Description="" UserOrGroupSid="S-1-5-32-544" Action="Allow"> <Conditions> <FilePathCondition Path="*.*" /> </Conditions> </FilePathRule> </RuleCollection> "@) New-CimInstance -Namespace $namespaceName -ClassName $classNameMSI -Property @{ParentID=$parentID;InstanceID="MSI";Policy=$obj} $obj = [System.Net.WebUtility]::HtmlEncode(@" <RuleCollection Type="Script" EnforcementMode="Enabled"> <FilePathRule Id="06dce67b-934c-454f-a263-2515c8796a5d" Name="All scripts in Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%PROGRAMFILES%\*" /> </Conditions> </FilePathRule> <FilePathRule Id="9428c672-5fc3-47f4-808a-a0011f36dd2c" Name="All scripts in Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%WINDIR%\*" /> </Conditions> </FilePathRule> <FilePathRule Id="ed97d0cb-15ff-430f-b82c-8d7832957725" Name="Allow for Administrators" Description="" UserOrGroupSid="S-1-5-32-544" Action="Allow"> <Conditions> <FilePathCondition Path="*" /> </Conditions> </FilePathRule> </RuleCollection> "@) New-CimInstance -Namespace $namespaceName -ClassName $classNameScript -Property @{ParentID=$parentID;InstanceID="Script";Policy=$obj} $obj = [System.Net.WebUtility]::HtmlEncode(@" <RuleCollection Type="Dll" EnforcementMode="Enabled"> <FilePathRule Id="bac4b0bf-6f1b-40e8-8627-8545fa89c8b6" Name="All DLLs in Windows folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%WINDIR%\*" /> </Conditions> </FilePathRule> <FilePathRule Id="3737732c-99b7-41d4-9037-9cddfb0de0d0" Name="All DLLs in Program Files folder" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePathCondition Path="%PROGRAMFILES%\*" /> </Conditions> </FilePathRule> <FilePublisherRule Id="1f0d0ec5-8523-4aa0-976a-ad2d2c21eed7" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"> <BinaryVersionRange LowSection="*" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> </RuleCollection> "@) New-CimInstance -Namespace $namespaceName -ClassName $classNameDLL -Property @{ParentID=$parentID;InstanceID="DLL";Policy=$obj} $obj = [System.Net.WebUtility]::HtmlEncode(@" <RuleCollection Type="Appx" EnforcementMode="Enabled"> <FilePublisherRule Id="a9e18c21-ff8f-43cf-b9fc-db40eed693ba" Name="All signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="*" ProductName="*" BinaryName="*"> <BinaryVersionRange LowSection="0.0.0.0" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> </RuleCollection> "@) New-CimInstance -Namespace $namespaceName -ClassName $classNameStoreApps -Property @{ParentID=$parentID;InstanceID="Storeapps";Policy=$obj} [/CODE] [S]WARNING!!! [B][SIZE=4][COLOR=rgb(184, 49, 47)]If one would like to modify the script, then please remember to not block PowerShell (powershell.exe).[/COLOR][/SIZE][/B] The restrictions for EXE files (and also DLLs) block also Administrators. So, PowerShell would be blocked even with high privileges and Applocker management would be impossible. The restrictions for PowerShell are for .ps1 files (but Administrators can still run scripts) and Constrained Language Mode.[/S] PowerShell can be also blocked with administrative rights. The policies do not block processes started from the system shell (with system privileges). [B][COLOR=rgb(184, 49, 47)]Warning!!! I strongly recommend making a System Restore Point before applying the Applocker rules.[/COLOR][/B] Post edited/updated. [/QUOTE]
Insert quotes…
Verification
Post reply
Top