forked from Axlfc/get-winget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-pulseaudio.ps1
executable file
·40 lines (31 loc) · 1.5 KB
/
install-pulseaudio.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
Set-ExecutionPolicy RemoteSigned
$MyLink = "http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip"
Write-Host "Pulseaudio is being downloaded"
Invoke-WebRequest -Uri $MyLink -OutFile "pulseaudio-1.1.zip"
Write-Host "Pulseaudio installer downloaded, try to decompress to C:\pulse\"
Expand-Archive -LiteralPath pulseaudio-1.1.zip -DestinationPath "C:\pulse\"
# Set service with path C:\pulse\pulseaudio.exe
# Set startupdirectory C:\pulse
# Set arguments -F C:\pulse\config.pa --exit-idle-time=-1
# startup type automatic
$serviceName = "PulseAudio"
if (Get-Service $serviceName -ErrorAction SilentlyContinue)
{
$serviceToRemove = Get-WmiObject -Class Win32_Service -Filter "name='$serviceName'"
$serviceToRemove.delete()
"service removed"
}
else
{
"service does not exists"
}
"installing service"
$secpasswd = ConvertTo-SecureString "MyPassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (".\MYUser", $secpasswd)
$binaryPath = "C:\pulse\pulseaudio.exe -F C:\pulse\config.pa --exit-idle-time=-1"
New-Service -name $serviceName -binaryPathName $binaryPath -displayName $serviceName -startupType Automatic -credential $mycreds
"service installation completed"
"START Configure PulseAudio for Windows."
New-Item "C:\pulse\config.pa" -ItemType File -Value "load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;172.16.0.0/12
load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1;172.16.0.0/12
load-module module-waveout sink_name=output source_name=input record=0"