#How to request administrator privileges

13 messages · Page 1 of 1 (latest)

torn sage
#

Hi, i'am using tauri v2, who can say me how to request administrator privileges on windows ?

I tried

fn main() {
    let win_attr = tauri_build::WindowsAttributes::new().app_manifest(
        r#"
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>
        </security>
      </trustInfo>
    </assembly>
    "#,
  );
    let attr = tauri_build::Attributes::new().windows_attributes(win_attr);
    tauri_build::try_build(attr).unwrap();
}

but when i execute it in admin mod, nothing append...

C:\Users\mamat\Desktop\projects\Vibra>npm run tauri dev

> vibra@0.1.0 tauri
> tauri dev

    Info Watching C:\Users\mamat\Desktop\projects\Vibra\src-tauri for changes...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.54s

C:\Users\mamat\Desktop\projects\Vibra>
faint monolith
#

but when i execute it in admin mod, nothing append...
Do you mean that you're running the command in a terminal that already has admin permission?

#

try tauri build / tauri build --debug instead and check what happens if you double click the executable

torn sage
#

if yes i got:

> vibra@0.1.0 tauri                                                                                                     > tauri build / tauri build                                                                                                                                                                                                                     error: unexpected argument '/' found                                                                                                                                                                                                            Usage: cargo.exe build [OPTIONS]                                                                                                                                                                                                                For more information, try '--help'.                                                                                     failed to build app: failed to build app                                                                                    Error failed to build app: failed to build app                                                                                                                                                                                              C:\Users\mamat\Desktop\projects\Vibra>

#

ohh

#

well

#

Sry

#

my screen luminosity is so low i didn't see that it was 2 different commands 😅

torn sage
#

🤣 Haha, so yeah now in my release/vibra.exe it ask me to start in admin mod.

#

Just is there a way to change the publisher ? (currently unknown)

faint monolith
#

ehh i always forget, that may require signing the app/installer