Discovering Share Permissions(ACL) on Windows Servers using PowerShell

Introduction: Managing permissions on shared folders is a crucial aspect of maintaining data security and accessibility within an organization’s network infrastructure. Windows servers offer various tools and methods to inspect … Read More

Get active Computers in Forest

$ForestInfo=Get-ADForest $Domains =$forestInfo.domains $FileName =$ForestInfo.RootDomain+”-Windows_Servers_60-9_Days_Active-“+”$(get-date -Format MM-dd-yyyy)”+”.csv” $FilePath = “c:\temp” $Daysactive = 60 $lastactive=(get-date).AddDays(-($Daysactive)) foreach($domain in $domains){ Write-Output “Working on $domain” Get-ADComputer -Filter {OperatingSystem -like “*server*” -and lastlogondate -gt $lastactive … Read More

Share folder permissions

#Share Folder Path $FolderPath = dir -Path “\\server1.vmwarenterprise.com\Reports\” -Recurse -Directory -Force$Report = @()Foreach ($Folder in $FolderPath) {$Acl = Get-Acl -Path $Folder.FullNameforeach ($Access in $acl.Access){$Properties = [ordered]@{‘FolderName’=$Folder.FullName;’ADGroup or User’=$Access.IdentityReference;’Permissions’=$Access.FileSystemRights;’Inherited’=$Access.IsInherited}$Report += New-Object … Read More

Get DNS forwarder from forest

#Domain names in forest $ForestInfo = Get-ADForest$Domains =$forestInfo.domains$FileName = “DNSForwarder”+”$(get-date -Format MM-dd-yyyy)”+”.csv”$FilePath = “c:\temp”foreach($domain in $domains){Write-Output “Working on $domain”get-dnsserverforwarder -computer $domain| select IPAddress, @{l=”Domain”;e={$domain}}| Export-Csv -NoTypeInformation $FilePath\$FileName -append}

Get IP address and DNS of remote computers

$Computers = GC “c:\temp\servers.txt” foreach($computer in $computers){Get-WMIObject Win32_NetworkAdapterConfiguration -Computername $Computer | Where-Object {$_.IPEnabled -match “True”} |Select-Object -property DNSHostName,@{N=”DNSServerSearchOrder”;E={“$($_.DNSServerSearchOrder)”}},@{N=’IPAddress’;E={$_.IPAddress}}|export-csv c:\temp\DNSlist.csv -NoTypeInformation -append#@{N=’DefaultIPGateway’;E={$_.DefaultIPGateway}}}