Hi people
I am trying to find out how wide the issue is where a number or servers have lost logon as a service right. The username has reverted to a SID so rights are not being applied. Th account is a local admin account on all servers and right is applied to customer OU only.
When i run the following script:-
BODY { FONT-SIZE: 12px; OVERFLOW: auto; FONT-FAMILY: Segoe UI; FONT-WEIGHT: 400; FONT-STYLE: normal } .relevanceDefault{font-family: Courier New;font-size: 10pt;color:#000000;background:#ffffff;} .relevanceKeyword{font-family: Courier New;font-size: 10pt;color:#0000ff;background:#ffffff;} .relevanceIgnored{font-family: Courier New;font-size: 10pt;color:#a9a9a9;background:#ffffff;} .relevanceOperator{font-family: Courier New;font-size: 10pt;color:#0000ff;background:#ffffff;} .relevanceString{font-family: Courier New;font-size: 10pt;color:#008080;background:#ffffff;} .relevanceConstant{font-family: Courier New;font-size: 10pt;color:#800080;background:#ffffff;} .relevanceMatchingParen{font-weight: bold;font-family: Courier New;font-size: 10pt;color:#ffffff;background:#ff9632;} .relevanceUnmatchedParen{font-weight: bold;font-family: Courier New;font-size: 10pt;color:#ffffff;background:#ff0000;} .relevanceQuestion{font-family: Courier New;font-size: 10pt;color:#ff0000;background:#ffffff;} .relevanceAnswer{font-family: Courier New;font-size: 10pt;color:#ff0000;background:#ffffff;} .relevanceIllegalCharacter{font-family: Courier New;font-size: 10pt;color:#ffffff;background:#ff0000;} .relevanceComment{font-family: Courier New;font-size: 10pt;color:#008000;background:#ffffff;} .relevanceItColorized{font-family: Courier New;font-size: 10pt;color:#000000;background:#afffaa;}
Createfile until EOF # Export the security policy to a temporary file $tempFile = â$env:TEMP\secpol.infâ secedit /export /cfg $tempFile # Read the contents of the file $secpolContent = Get-Content -Path $tempFile # Find the line that contains the âLogon As A Serviceâ right $logonAsServiceLine = $secpolContent | Select-String -Pattern âSeServiceLogonRightâ # Display the value if ($logonAsServiceLine) { $logonAsServiceValue = $logonAsServiceLine -replace "SeServiceLogonRight = ", ââ Write-Output âLogon As A Service right is assigned to: $logonAsServiceValueâ } else { Write-Output âNo âLogon As A Serviceâ right found in the security policy.â } # Clean up the temporary file Remove-Item -Path $tempFile EOF copy __createfile c:\temp\ServiceLogonUers.ps1 //Run script to create file with list of users\groups that have âlogon as a service rightsâ runhidden cmd.exe /c powershell.exe -ExecutionPolicy Bypass âc:\temp\ServiceLogonUers.ps1 | Out-File -FilePath C:\temp\LogonUsers.logâ
I get correct output in the file logonUsers.log as follows:-
Line 1= blank for some reason
Line2=The task has completed successfully.
line3=See log %windir%\security\logs\scesrv.log for detail info.
line4=Logon As A Service right is assigned to: *S-1-5-21-1281000843-3793813838-1924240112-1001,*S-1-5-21-1613761897-167951834-1983490406-500
So I am trying a managed property with following syntax:-
line 4 of files âC:\temp\LogonUsers.logâ
in relevance debugger the output is
%00
Any ideas what i am doing wrong??