-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallUninstall.ps1
71 lines (55 loc) · 1.72 KB
/
InstallUninstall.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
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
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
Write-Host "please run elevated user"
Start-Sleep -s 5
exit
}
$url="http://35.156.50.195/esbackup/winizleyici.zip"
$file ="winizleyici.zip"
$output = $env:APPDATA+"\Aryasoft"
$destFile = $output+"\winizleyici.zip"
Set-ExecutionPolicy Bypass -Force -CurrentUser
function Install(){
New-Item -ItemType Directory -Force -Path $output
Download
while($true)
{
if(test-path $destFile)
{
Expand-Archive $destFile -DestinationPath $output
rm $destFile
break
}
}
cd $output
.\winizleyici\install-service-filebeat.ps1
Write-Host -BackgroundColor Green -ForegroundColor White "******************"
Write-Host -BackgroundColor Green -ForegroundColor White "Install Completed"
Write-Host -BackgroundColor Green -ForegroundColor White "******************"
}
function Download(){
(New-Object System.Net.WebClient).DownloadFile($url, $destFile)
Write-Host -BackgroundColor Green -ForegroundColor White "Download Completed"
}
function StartP(){
cd $output
.\winizleyici\saruman.exe
#Start-Service filebeat
Write-Host -BackgroundColor Green -ForegroundColor White "Started"
}
function Stop(){
kill -Name saruman
Stop-Service filebeat
Write-Host -BackgroundColor Green -ForegroundColor Red "Stopped"
}
function Uninstall(){
cd $output
.\winizleyici\uninstall-service-filebeat.ps1
cd ..
rm Aryasoft -Force -Recurse
Write-Host -BackgroundColor Green -ForegroundColor Red "Uninstall Completed"
}
Install
StartP
#Stop
#Uninstall