init commit

This commit is contained in:
iFlip721
2025-04-16 09:55:57 -04:00
commit a03209dc9e
935 changed files with 177492 additions and 0 deletions

52
New-PPTAuth.ps1 Normal file
View File

@@ -0,0 +1,52 @@
function New-PPTAuth {
begin {
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
Write-host "Creating authentication profile" -ForegroundColor Cyan
#Start-Process -FilePath $Global:pptConfig.pacPath
& $Global:pptConfig.pacPath auth clear | ForEach-Object {
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
Write-host "$_" -ForegroundColor Cyan
}
}
process {
$isAuth = $false
& $Global:pptConfig.pacPath auth create --cloud UsGovDod --deviceCode | ForEach-Object {
if ($_ -match 'To sign in, use a web browser to open the page') {
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
Write-host "$_" -ForegroundColor Cyan
Set-Clipboard -Value "$(($_ -split "To sign in, use a web browser to open the page | and enter the code | to authenticate.")[2])"
Start-Process microsoft-edge:https://microsoft.com/deviceloginus -OutVariable procout
} else {
if ($_ -match 'authenticated successfully') {
$isAuth = $true
}
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
Write-host "$_" -ForegroundColor Cyan
}
}
}
end {
if($isAuth) {
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
Write-host "Authentication complete" -ForegroundColor Cyan
return $true
} else {
Write-Host "[ Error ] " -ForegroundColor Yellow -nonewline
Write-Host "No profiles were found on this computer" -ForegroundColor Yellow
return $false
}
}
}
New-Alias -Name auth -Value New-PPTAuth -Description 'posh-PowerPlatformToolkit - New-PPTAuth alias' -Force