I have found my own solution
first command
`$Plan = powercfg /getactivescheme
$Plan -match 'Power Scheme GUID: (?<gu>\w\w\w\w\w\w\w\w-\w\w\w\w-\w\w\w\w-\w\w\w\w-\w\w\w\w\w\w\w\w\w\w\w\w).'
$ExcistGUID = $Matches.gu
$Startdir = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\' -Name 'Local AppData' | Select-Object -ExpandProperty 'Local AppData'
$Tempdir = $Startdir + "\Temp"
$CachedPowerPlan = $Startdir + "\CachedPowerGUID.txt"
# Output plan GUID to file (Not forced so if script ran twice, it won't overwrite the first run)
New-Item -Path (Split-Path -Path $CachedPowerPlan) -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
New-Item -Path $CachedPowerPlan -ItemType File -force -Value $ExcistGUID -ErrorAction Stop | Out-Null
$GUID = New-Guid
powercfg /duplicatescheme $ExcistGUID $GUID
powercfg /setactive $GUID
timeout 2
powercfg /change /standby-timeout-ac 0
$GUID2 = $Startdir + "\temppowerGUID.txt"
New-Item -Path (Split-Path -Path $GUID2) -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
New-Item -Path $GUID2 -ItemType File -force -Value $GUID -ErrorAction Stop | Out-Null"`
then the command to reset and delete the temp power scheme
this was set up to run as two seperate files on an RMM
`$Startdir = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\' -Name 'Local AppData' | Select-Object -ExpandProperty 'Local AppData'
$Tempdir = $Startdir + "\Temp"
$CachedPowerPlan = $Startdir + "\CachedPowerGUID.txt"
$GUID = $Startdir + "\temppowerGUID.txt"
$CachedPowerPlan = $Startdir + "\CachedPowerGUID.txt"; $CachedPowerGuid = Get-Content -Path $CachedPowerPlan; powercfg /setactive $CachedPowerGuid; $GUID = Get-Content -path $GUID; powercfg /delete $GUID`