ppkg-script.ps1

# THIS IS BEING CALLED IN THE PROVISIONING PACKAGE

# Define the registry path
$regPath = "HKLM:\SOFTWARE\Policies\Microsoft\PassportForWork"

# Create the registry path if it doesn't exist
if (-not (Test-Path -Path $regPath)) {
    Write-Host "Registry path $regPath does not exist. Creating it..."
    New-Item -Path $regPath -Force | Out-Null
    Write-Host "Registry path created successfully."
}

# Set the registry values
# This will create the properties if they don't exist or update them if they do
Set-ItemProperty -Path $regPath -Name "Enabled" -Value 1 -Type DWord -Force
Set-ItemProperty -Path $regPath -Name "DisablePostLogonProvisioning" -Value 1 -Type DWord -Force

Write-Host "Successfully configured PassportForWork settings:"
Write-Host "Enabled = 1"
Write-Host "DisablePostLogonProvisioning = 1"


# # Define the MSI file name
# $msiFile = ".\NinjaOne-Agent-JRanckElectric-MTP-Auto.msi"

# # Define silent installation arguments
# $msiArgs = "/i $msiFile /qn /norestart"

# Write-Host "Starting MSI installation..."
# # Start the MSI installation and wait for it to complete
# Start-Process -FilePath "msiexec.exe" -ArgumentList $msiArgs -Wait

# Write-Host "MSI installation finished. Proceeding with other tasks..."