aquila98
asked on
how to check group permission on a file located on a remote server ?
Hello
I need to perform the equivalent of :
icacls C:\Windows\System32\winevt \Logs\appl ication.ev tx to check if AD group [domain]\[GROUPNAME] has the right to see the log.
I need to do this for each and every server on our company's vlan!
I think this could be automated... but how can my desktop connect to each server to perform the same function as icacls ??? ( I am of course admin of all of the servers)
I tried with SelectQuery = New SelectQuery(String.Format( "SELECT * FROM Win32_Directory WHERE name = '{0}'", sFileName)) or ManagementObject with a scope but then how can I obtain the list of permissions ???
Have you any hints as to how I should proceed ???
thanks
I need to perform the equivalent of :
icacls C:\Windows\System32\winevt
I need to do this for each and every server on our company's vlan!
I think this could be automated... but how can my desktop connect to each server to perform the same function as icacls ??? ( I am of course admin of all of the servers)
I tried with SelectQuery = New SelectQuery(String.Format(
Have you any hints as to how I should proceed ???
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
not too bad for a newby ;)
ASKER
function Get-PathPermissions {
param ( [Parameter(Mandatory=$true
begin {
$root = Get-Item $Path
($root | get-acl).Access | Add-Member -MemberType NoteProperty -Name "Path" -Value $($root.fullname).ToString
}
process {
$containers = Get-ChildItem -path $Path -recurse | ? {$_.psIscontainer -eq $true}
if ($containers -eq $null) {break}
foreach ($container in $containers)
{
(Get-ACL $container.fullname).Acces
}
}
}
$ErrorActionPreference = "Stop"
$secpasswd = ConvertTo-SecureString "mypassword" -AsPlainText -Force
$credential = New-Object System.Management.Automati
Enter-PSSession -ComputerName "theremoteserver.net" -Credential $credential
Get-PathPermissions $args[0]
Exit-PSSession
and I call it thusly from a dos command window:
powershell -executionPolicy bypass -file "d:\temp\myscript.ps1" "C:\Windows\System32\winev
what is wrong ?
thanks for any tips