-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGet-ChromeExtension.ps1
More file actions
74 lines (62 loc) · 2.76 KB
/
Get-ChromeExtension.ps1
File metadata and controls
74 lines (62 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function Sort-PDFs {
param(
[Parameter(Mandatory=$False)][string]$Source = "C:\This\Is\Where\MyPdfs\Live",
[Parameter(Mandatory=$False)][string]$Destination = "E:\This\Is\Their\NewHome",
[Parameter(Mandatory=$False)][string]$Since = "10"
)
$Files = Get-ChildItem -path $Source -Include *.pdf -Recurse
foreach($File in $Files) {
if(((Get-Date) - $File.LastWriteTime) -gt (New-TimeSpan -Minutes $Since)) {
Move-Item -LiteralPath $File.fullname -Destination (Join-Path $Destination $File.name)
}
}
}
Function Get-ChromeExtension {
param (
[string]$ComputerName = $env:COMPUTERNAME
)
Get-ChildItem "\\$ComputerName\c$\users\*\appdata\local\Google\Chrome\User Data\Default\Extensions\*\*\manifest.json" -ErrorAction SilentlyContinue | % {
$_.FullName -match 'users\\(.*?)\\appdata' | Out-Null
Get-Content $_.FullName | ConvertFrom-Json | select @{n='ComputerName';e={$ComputerName}}, @{n='User';e={$Matches[1]}}, name, version
}
}
# https://social.technet.microsoft.com/Forums/office/en-US/4f6815f1-2998-484c-a423-fe6507f1548c/powershell-script-to-fetch-logonlogoff-user-on-particular-server-getwinevent-geteventlog?forum=winserverpowershell
function Get-LogonHistory {
param (
[string]$Computer = $env:COMPUTERNAME,
[int]$Days = 1
)
$filterXml = "
<QueryList>
<Query Id='0' Path='System'>
<Select Path='System'>
*[System[
Provider[@Name = 'Microsoft-Windows-Winlogon']
and
TimeCreated[@SystemTime >= '$(Get-Date (Get-Date).AddDays(-$Days) -UFormat '%Y-%m-%dT%H:%M:%S.000Z')']
]]
</Select>
</Query>
</QueryList>
"
$ELogs = Get-WinEvent -FilterXml $filterXml -ComputerName $Computer
# $ELogs = Get-EventLog System -Source Microsoft-Windows-WinLogon -After (Get-Date).AddDays(-$Days) -ComputerName $Computer
if ($ELogs) {
$(foreach ($Log in $ELogs) {
switch ($Log.id) {
7001 {$ET = 'Logon'}
7002 {$ET = 'Logoff'}
default {continue}
}
New-Object PSObject -Property @{
Time = $Log.timecreated
EventType = $ET
User = (New-Object System.Security.Principal.SecurityIdentifier $Log.Properties.value.value).Translate([System.Security.Principal.NTAccount])
}
}) | sort time -Descending
} else {
Write-Host "Problem with $Computer."
Write-Host "If you see a 'Network Path not found' error, try starting the Remote Registry service on that computer."
Write-Host 'Or there are no logon/logoff events (XP requires auditing be turned on)'
}
}