20250305 more notes

This commit is contained in:
2025-03-05 07:54:52 +01:00
parent e5d8008751
commit efe7e94505
7 changed files with 353 additions and 78 deletions

View File

@@ -0,0 +1,46 @@
```powershell
#Download and Run MSI package for Automated install
## VZ
#$uri = "https://eu.ninjarmm.com/agent/installer/22ea45a7-e951-4229-b305-ef9178339f0c/verbraucherzentralebayernmnchenmo9-7.0.2317-windows-installer.msi"
## SBX link for tests
$uri = "https://eu.ninjarmm.com/agent/installer/f816281d-6f56-4f13-abd6-5d4abf4dc67a/softboxhauptsitz-7.0.2317-windows-installer.msi"
$out = "c:\Temp\NinjaOneInstaller.msi"
if ( !( Test-Path "C:\Temp" ) )
{
New-Item -ItemType Directory -Path "C:\Temp"
}
Function Download_MSI_NinjaOne_Installer{
Invoke-WebRequest -uri $uri -OutFile $out -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::FireFox)
$msifile = Get-ChildItem -Path $out -File -Filter '*.ms*'
write-host "NinjaOne MSI $msifile "
}
$msifile = Get-ChildItem -Path $out -File -Filter '*.ms*'
Function Install_NinjaOne{
write-host "NinjaOne MSI $msifile "
$FileExists = Test-Path $msifile -IsValid
$DataStamp = get-date -Format yyyyMMddTHHmmss
$logFile = '{0}-{1}.log' -f $msifile.fullname,$DataStamp
$MSIArguments = @(
"/i"
('"{0}"' -f $msifile.fullname)
"/qn"
"/norestart"
"/L*v"
$logFile
)
If ($FileExists -eq $True)
{
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -passthru | wait-process
write-host "Finished msi "$msifile
}
Else {Write-Host "File doesn't exists"}
}
Download_MSI_NinjaOne_Installer
$msifile = Get-ChildItem -Path $out -File -Filter '*.ms*'
Install_NinjaOne
```