3kh0 / state-test

Ways to take state tests unrestricted
16 stars 3 forks source link

Virginia #12

Open ImPosh opened 1 year ago

ImPosh commented 1 year ago

You open a shortcut which runs the power shell code `<#----------------------------------

Name: LaunchTestNav8.ps1

Description: Launches TestNav with default based on shortcut

Change Log 03/25/2022 - JFH - Created 08/16/2022 - JFH - Updated taskkill list

----------------------------------#>

param (

[switch]$sol,
[switch]$nnat3

)

----------------------------------

Create and assign values to global variables

$APPXPackage = Get-AppxPackage -Name 'TestNav' $PackageFamilyName = $APPXPackage.PackageFamilyName $APPID = (Get-AppxPackageManifest $APPXPackage.PackageFullName).Package.Applications.Application.id $TNPackage = Get-ChildItem -Path "$env:LOCALAPPDATA\Packages\" -Force | Where-Object {$_.Name -like 'TestNav'} | Select-Object -ExpandProperty Name $AppList = @( 'AdobeARM' 'AdobeUpdater' 'apoint' 'apsdaemon' 'chrome' 'cmd' 'code' 'dax64' 'desktopmenu' 'excel' 'firefox' 'GoogleDriveFS' 'GoogleSyncFS' 'GoogleUpdate' 'iexplore' 'imagine.winclient' 'itunes' 'ituneshelper' 'jusched' 'mblctr' 'MEUIHLP' 'monitorservice' 'msaccess' 'msedge' 'mspub' 'onedrive' 'onenote' 'outlook' 'powerpnt' 'powershell_ise' 'qttask' 'ResponseSoftwareService' 'SMARTBoardService' 'Smartboardtools' 'SMARTInk' 'SMARTInk-SBSDKProxy' 'SMARTNotification' 'SMARTSystemMenu' 'snagit32' 'snagiteditor' 'SoftwareUpdate' 'SynchronEyesSrv' 'Syncsvc' 'teams' 'winword' 'Zoom' 'Zoom_launcher' )

----------------------------------

Find current TestNav package path

If ((Test-Path -Path "$env:LOCALAPPDATA\Packages\$TNPackage\LocalCache\Local\Pearson\TestNav\") -ne $true) { New-Item -ItemType Directory -Path "$env:LOCALAPPDATA\Packages\$TNPackage\LocalCache\Local\Pearson\TestNav\" -Force }

Copy over default file bases on parameters

If ($sol) { $TNPackage | Foreach-Object -Process { Copy-Item -Path 'C:\Program Files\FCPS\TestNav\sol' -Destination "$env:LOCALAPPDATA\Packages\$\LocalCache\Local\Pearson\TestNav\default." -Force } } ElseIf ($nnat3){ $TNPackage | Foreach-Object -Process { Copy-Item -Path 'C:\Program Files\FCPS\TestNav\nnat3' -Destination "$env:LOCALAPPDATA\Packages\$\LocalCache\Local\Pearson\TestNav\default." -Force } } Else { $TNPackage | Foreach-Object -Process { Copy-Item -Path 'C:\Program Files\FCPS\TestNav\sol' -Destination "$env:LOCALAPPDATA\Packages\$_\LocalCache\Local\Pearson\TestNav\default." -Force } }

End all web browser and O365 processes

$AppList | Foreach-Object -Process { Get-Process -Name $_ | Stop-Process -Force -ErrorAction SilentlyContinue}

$Launcher = $("Shell:AppsFolder\$PackageFamilyName!$APPID")

Launch TestNav

Start-Process -FilePath $Launcher

###########################

Start-Sleep 8

function Set-WindowStyle { param( [Parameter()] [ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE', 'SHOW', 'SHOWDEFAULT', 'SHOWMAXIMIZED', 'SHOWMINIMIZED', 'SHOWMINNOACTIVE', 'SHOWNA', 'SHOWNOACTIVATE', 'SHOWNORMAL')] $Style = 'SHOW', [Parameter()] $MainWindowHandle = (Get-Process -Id $pid).MainWindowHandle ) $WindowStates = @{ FORCEMINIMIZE = 11; HIDE = 0 MAXIMIZE = 3; MINIMIZE = 6 RESTORE = 9; SHOW = 5 SHOWDEFAULT = 10; SHOWMAXIMIZED = 3 SHOWMINIMIZED = 2; SHOWMINNOACTIVE = 7 SHOWNA = 8; SHOWNOACTIVATE = 4 SHOWNORMAL = 1 } Write-Verbose ("Set Window Style {1} on handle {0}" -f $MainWindowHandle, $($WindowStates[$style]))

$Win32ShowWindowAsync = Add-Type –memberDefinition @” [DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); “@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru

$Win32ShowWindowAsync::ShowWindowAsync($MainWindowHandle, $WindowStates[$Style]) | Out-Null }

(Get-Process -Name TestNav).MainWindowHandle | foreach { Set-WindowStyle MAXIMIZE $_ }

` If you try to open anything it shuts down the test and makes you login again Thats pretty much it

VillainsRule commented 1 year ago
  1. Can you run powershell code normally?
  2. When can you use this shortcut?
  3. I assume you're on a Windows, correct?
ImPosh commented 1 year ago

1 I believe so

  1. anytime
  2. yes im on windows
catfoolyou commented 9 months ago

Our district (and maybe some others) have switched over to chromebooks with only CS students using normal windows laptops, I wonder how the hell we will be taking the tests this year.

VillainsRule commented 9 months ago

Kiosk apps

catfoolyou commented 9 months ago

Ah

ImPosh commented 9 months ago

Yea Same our school went to chromebooks