Added scripts
This commit is contained in:
9
PowerShell/Create-Printers.ps1
Normal file
9
PowerShell/Create-Printers.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
$Printers = Import-Csv -Path "C:\temp\PrinterList.csv" -Encoding UTF8 -delimiter ","
|
||||
|
||||
foreach ($Printer in $Printers)
|
||||
{
|
||||
|
||||
Add-PrinterPort -Name $Printer.IP -PrinterHostAddress $Printer.IP -Verbose
|
||||
Add-Printer -Name $Printer.PrinterName -DriverName $Printer.Driver -Location $Printer.Location -PortName $Printer.IP -Verbose
|
||||
|
||||
}
|
||||
11
PowerShell/List file access.ps1
Normal file
11
PowerShell/List file access.ps1
Normal file
@@ -0,0 +1,11 @@
|
||||
get-Acl -Path C:\users\* | out-gridview
|
||||
|
||||
$FolderPath = Get-ChildItem -Directory -Path "C:\users\*"
|
||||
|
||||
ForEach ($Folder in $FolderPath) {
|
||||
$Acl = Get-Acl -Path $Folder.FullName
|
||||
ForEach ($Access in $Acl.Access) {
|
||||
$Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
|
||||
New-Object -TypeName PSObject -Property $Properties
|
||||
Out-GridView }
|
||||
}
|
||||
12
PowerShell/get-eventid.ps1
Normal file
12
PowerShell/get-eventid.ps1
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
$server = 127.0.0.1
|
||||
$starttime = get-date -Format yyyy-MM-dd
|
||||
|
||||
Get-EventLog Application -ComputerName $server -After $starttime |
|
||||
? { $_.entryType -Match "Error" -and "Critical" } |
|
||||
Group-Object -Property EventID |
|
||||
% { $_.Group[0] | Add-Member -PassThru -NotePropertyName Count -NotePropertyValue $_.Count } |
|
||||
Sort-Object EventID -Unique |
|
||||
Select-Object Count, TimeGenerated, EventID, Source, Message |
|
||||
ft -AutoSize -Wrap |
|
||||
Out-File $file -Append
|
||||
Reference in New Issue
Block a user