1

Good day! Trying to make cache cleaner script for automatisation purpose. We have program called Pilot-Ice, it has registry key under HKEY_CURRENT_USER\SOFTWARE\ASCON\Pilot-ICE Enterprise\System There's a value called "CurrentCachePath", i need to get to it from python.

Currentry, i have 'sketch' code to get to it:

def get_cache_drive():
    pilot_cache_regkey = "HKEY_CURRENT_USER\SOFTWARE\ASCON"
    reg = subprocess.check_output(f'Reg Query "{pilot_cache_regkey}" /s', shell=True).decode('utf-8')
    reg_split = reg.split(' ')[-2]
    return reg_split.split('\\')[-3]

Trying to check how's my script working using PsExec, but using remote terminal, output gives me access to only this:

HKEY_CURRENT_USER\SOFTWARE\ASCON\Pilot-ICE Enterprise
installed    REG_DWORD    0x1

Any ideas how to get full access while running python program using psexec? Run command:

C:\Users\<username>\AppData\Local\Programs\Python\Python310\pythonw.exe C:\PilotCleaner\cleaner.py

Also i have a little question about subprocess.check_output('Reg Query...'), it returns just string with path in it, like this:

HKEY_CURRENT_USER\SOFTWARE\ASCON\Pilot-ICE Enterprise\System
CurrentCachePath    REG_SZ    D:\PilotCache\Pilot-ICE Enterprise

How can i get only path string from it? D:\PilotCache\Pilot-ICE Enterprise In code below, i'm doing it by splitting few times, but this is not universal for all users. All i need, is to get at least drive word and folder next to it, so i can make few path samples to check, like:

  1. D:\PilotCache
  2. C:\Users
  3. C:\PilotCache

Or full path will be better of course, if it's possible to exctact it correctly

0 Answers0