Repository navigation
Expand file tree
/
Copy path_export.ps1
More file actions
41 lines (35 loc) · 1.66 KB
/
Copy path_export.ps1
File metadata and controls
41 lines (35 loc) · 1.66 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
<######################################
SYNOPSIS
Data scrapes all anchors from website to CSV with full tag info and exports href elements to a text document.
DESCRIPTION
Generates a report proivding detailed information for all links on the set site.
NOTES
File Name : get-URL.ps1
Author : Luke Encrapera
Email : luke.encrapera@gianteagle.com
Requires : PowerShell V2+
Documentation can be found in About.txt
######################################>
#SetExecutionPolicy -Unrestricted
function export_CSV {
Clear-Host
$geturl=Invoke-WebRequest http://gecentral/Pages/ViewAllApplications.aspx -UseDefaultCredentials
Start-Sleep -Seconds 1.5
$links = ($geturl.Links <#|Where href -match '\url=http\d+' | where class -NotMatch '+'#>)
#$links.outertext + $links.href #| Select-Object -First 6 #Need to filter out recents
$logondomain = whoami
$username = $logondomain -replace ".*\\"
$links | Export-Csv "C:\Users\$username\Documents\GitHub\Application-Availability\src\export.csv"
#C:\Users\914476\Documents\GitHub\Application-Availability
}
function export_TXT {
Clear-Host
$geturl=Invoke-WebRequest http://gecentral/Pages/ViewAllApplications.aspx -UseDefaultCredentials
$links = ($geturl.Links)
#$links | export-txt 'C:\Users\914476\Documents\Scripts\URLstatus\GEURLs.txt'
$logondomain = whoami
$username = $logondomain -replace ".*\\"
$links.href -replace '.*=' -replace 'javascript:;' -replace '#' | out-file -filepath "C:\Users\$username\Documents\GitHub\Application-Availability\src\links.txt" -Force -width 200 #Review -replace on href
}
export_CSV
export_TXT