Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Created July 12, 2021 09:02
Show Gist options
  • Select an option

  • Save JohnLBevan/589681c620313733cd68fe565140e312 to your computer and use it in GitHub Desktop.

Select an option

Save JohnLBevan/589681c620313733cd68fe565140e312 to your computer and use it in GitHub Desktop.
<# This script fixed the below issue
Log Name: Application
Source: Microsoft-Windows-CAPI2
Event ID: 513
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Description:
Cryptographic Services failed while processing the OnIdentity() call in the System Writer Object.
Details:
AddLegacyDriverFiles: Unable to back up image of binary Microsoft Link-Layer Discovery Protocol.
System Error:
Access is denied.
.
#>
$path = 'c:\Windows\system32\DRIVERS\mslldp.sys'
$nt = [System.Security.Principal.NTAccount]::new('NT AUTHORITY\SERVICE')
$read = [System.Security.AccessControl.FileSystemRights]::Read
$allow = [System.Security.AccessControl.AccessControlType]::Allow
$ar = [System.Security.AccessControl.FileSystemAccessRule]::new($nt, $read, $allow)
$acl = (Get-ACL -Path $path)
$acl.AddAccessRule($ar)
Set-Acl -Path $path -AclObject $acl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment