elevated-privileges

How to change system date and time with vb.net on windows 7

我是研究僧i 提交于 2019-12-02 17:40:33
问题 So I was trying to create a tiny program to rapidly change time on a windows 7. Following the "SetSystemTime(ByRef theDateTime As SYSTEMTIME)" like everyone does on the internet I did the same. But nothing happened. Here's the code: Imports System.Data Imports System.Text Imports System.Runtime.InteropServices Public Class Form1 Private WithEvents timer1 As New Timer <StructLayoutAttribute(LayoutKind.Sequential)> _ Private Structure SYSTEMTIME Public year As Short Public month As Short Public

How to change system date and time with vb.net on windows 7

爱⌒轻易说出口 提交于 2019-12-02 10:27:57
So I was trying to create a tiny program to rapidly change time on a windows 7. Following the "SetSystemTime(ByRef theDateTime As SYSTEMTIME)" like everyone does on the internet I did the same. But nothing happened. Here's the code: Imports System.Data Imports System.Text Imports System.Runtime.InteropServices Public Class Form1 Private WithEvents timer1 As New Timer <StructLayoutAttribute(LayoutKind.Sequential)> _ Private Structure SYSTEMTIME Public year As Short Public month As Short Public dayOfWeek As Short Public day As Short Public hour As Short Public minute As Short Public second As

How to elevate .net application permissions?

爱⌒轻易说出口 提交于 2019-12-02 06:05:20
I have an application that would check for updates upon start and, if updates are found, it would copy some files over the network to the program files folder. Obviously such task can't be performed by Standard Users under normal scenarios. I tried creating a service to do the update process but I had some security issues and I asked this question about it in superusers. Now, considering the fact that most applications require elevated privileges to perform such task I think that might be the right approach. But how do I request elevation for the updater under all Windows version as of XP,

Windows thinks signed installer is malware after security update (KB3124605)

痞子三分冷 提交于 2019-12-01 09:28:21
2 Years ago @Dejan Maksimovic asked a question about Internet Explorer shows valid certificate as “corrupt or invalid signature” . To date I am experiencing a comparable issue with an installer that needs elevated rights. The problem seems to be of the same origin but then for KB3124605 . Installer is signed using signtool and certificate is valid until August 2016. When I installed a cumulative update containing this patch Windows SmartScreen tells me that the publisher is unknown, but when I uninstall the Security update, Windows seems to be able to distinguish the publisher (the one that is

osx - How to programmatically delete a file with elevated privileges?

别来无恙 提交于 2019-12-01 08:05:39
I'm trying to remove a file form the ~/Library/PreferencePanes folder, and this cannot be done with normal privileges. Usually, if you need to delete any file from the ~/Library folder the system will ask for your username and password. The current way I do this is with [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error] but this keeps on returning an error ( [error localizedDescription] ): theAppName.prefPane couldn’t be removed because you don’t have permission to access it. What logic and code would I need to use in order to gain these elevated privileges needed for

osx - How to programmatically delete a file with elevated privileges?

大憨熊 提交于 2019-12-01 05:27:37
问题 I'm trying to remove a file form the ~/Library/PreferencePanes folder, and this cannot be done with normal privileges. Usually, if you need to delete any file from the ~/Library folder the system will ask for your username and password. The current way I do this is with [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error] but this keeps on returning an error ( [error localizedDescription] ): theAppName.prefPane couldn’t be removed because you don’t have permission to access

Restart program unelevated

北城以北 提交于 2019-11-30 20:23:21
For some reason, my C# program needs to restart with elevated privileges. I use the following code to achieve it: private static void RestartForPermissionsFix() { ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = Assembly.GetExecutingAssembly().Location; Process.Start(processInfo); } This works great. After I "fix my privileges", I want to restart the program unelevated . I tried the same as above without the "runas", but it does not work. I assume the process being started from an elevated process automatically gets elevated. Any idea?

Unable to supply password to runas from commandline

房东的猫 提交于 2019-11-30 09:54:17
问题 I am unable to supply password to runas from commandline I have tried the following cmd /C echo my_admin_password | runas /user:DOMAIN\my_admin_login c:\test.bat and echo my_admin_password | runas /user:DOMAIN\my_admin_login c:\test.bat And the error I get is Attempting to start c:\test.bat as user "DOMAIN\my_admin_login" ... RUNAS ERROR: Unable to run - c:\test.bat 1326: Logon failure: unknown user name or bad password. How do I fix this? 回答1: Take a look at this link: runas utility It's a

Restart program unelevated

社会主义新天地 提交于 2019-11-30 04:49:42
问题 For some reason, my C# program needs to restart with elevated privileges. I use the following code to achieve it: private static void RestartForPermissionsFix() { ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = Assembly.GetExecutingAssembly().Location; Process.Start(processInfo); } This works great. After I "fix my privileges", I want to restart the program unelevated . I tried the same as above without the "runas", but it does not

How to use ServerManager to read IIS sites, not IIS express, from class library OR how do elevated processes handle class libraries?

非 Y 不嫁゛ 提交于 2019-11-30 01:20:55
I have some utility methods that uses Microsoft.Web.Administration.ServerManager that I've been having some issues with. Use the following dead simple code for illustration purposes. using(var mgr = new ServerManager()) { foreach(var site in mgr.Sites) { Console.WriteLine(site.Name); } } If I put that code directly in a console application and run it, it will get and list the IIS express websites. If I run that app from an elevated command prompt, it will list the IIS7 websites. A little inconvenient, but so far so good. If instead I put that code in a class library that is referenced and