-
Notifications
You must be signed in to change notification settings - Fork 0
/
YandexDisk.ps1
30 lines (24 loc) · 1.26 KB
/
YandexDisk.ps1
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
[string]$compName = $env:COMPUTERNAME
[string]$userName = $env:USERNAME
[string]$user_comp = "$userName;$compName;"
[string]$last_email = ""
[string]$email = ""
[string]$path = ""
[string]$result = $user_comp
# YandexDisk
$regpath = 'HKCU:\SOFTWARE\Yandex\Yandex.Disk'
if (Get-ItemProperty $regpath -ErrorAction SilentlyContinue) {
$result += "Yandex.Disk installed;"
[xml]$xmlfile = Get-Content "$env:LOCALAPPDATA\Yandex\Yandex.Disk\config.xml"
if ($xmlfile."Yandex.Disk".User.Login) {
$email = $xmlfile."Yandex.Disk".User.Login + "@yandex.ru"
$result += "$email;" } else { $result += "E-mail not configured;" }
$path = Get-ItemPropertyValue $regpath -Name RootFodler -ErrorAction SilentlyContinue
if ($path) { $result += "$path;"} else { $result += "Path not configured;" }
$last_email = $xmlfile."Yandex.Disk".User.LastLogin + "@yandex.ru"
if ((($email) -and !($last_email)) -or (($email) -and ($last_email))) { $result += "Yandex.Disk is used;"} elseif (!($email) -and ($last_email)) { $result += "Yandex.Disk was once configured ($last_email);"}
} else { $result += "Yandex.Disk not installed;;;;" }
[string]$email = ""
[string]$path = ""
$result += "`n$user_comp"
$result > "\\fileserver\$compName-$userName.txt"