34 posts in this topic
I'm making an app that among other things has the system info feature, where it displays stuff like the system version, build, CPU and ram stats, etc.
So, I haven't been able to find anywhere a way to access the following things (is there even?):
Windows version (not like WIN_10, but the version like 1607, or 1511 Windows edition like professional, home, education, etc. information whether the Windows is registered or not (optionally the registrant's name) the type of the currently logged-in user (e.g., administrator) computer manufacturer and model (e.g., dell inc. Inspiron n5110 boot mode (e.g., safe, normal) CPU tempreture I'd appreciate a lot if any of you could help me with any of the things from above; it would mean a lot to me.
Have a great day.
I have a problem, I cant run script as administrator in Windows 10:
Global $sUserName = "administrator"
Global $sPassword = "pass"
Global $sDomain = "domain"
RunAsWait($sUserName, $sDomain, $sPassword, 2, "main.exe", "", @TempDir)
If I run "run.exe" it dont work...
If I change main.exe to this:
and it runs and shows administrator in message box... but it cant elevate main.exe with RegWrite() command...
I tried using #RequireAdmin in first line of main.exe, but it not worked... UAC is set to "do not notify"
This method of elevation worked on Windows 7 and Windows XP...
I've been using this UDF to set ACL permissions to some network folders, everything works great (no issues). However, I want to apply these permissions using elevated domain credentials supplied by the user and not the user that's currently running the script. As a temporary solution, I've implemented a RunAs function, but that's not the solution I'm looking for. I'm not fluent with using Dlls, but I have been trying out different methods.
My RunAs Function:
Func _RunAs($sUser, $sPass) If @Compiled Then RunAs($sUser, @LogonDomain, $sPass, 4, FileGetShortName(@ScriptFullPath), "", @SW_MAXIMIZE) Else RunAs($sUser, @LogonDomain, $sPass, 4, FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath), "", @SW_MAXIMIZE) EndIf EndFunc ;==>_RunAs I tried LogonUser and I know that I can take that token to ImpersonateLoggedOnUser, but I'm not sure how to implement that or if that's even the right method. I also need to RevertToSelf once completed.
Func _LogonUser($sUsername, $sPassword, $sServer = @LogonDomain) ; Returns True if user exists Local $stToken $stToken = DllStructCreate("int") Local $aRet = DllCall("advapi32.dll", "int", "LogonUser", _ "str", $sUsername, "str", $sServer, "str", $sPassword, "dword", 3, "dword", 0, "ptr", DllStructGetPtr($stToken)) ;$hToken = DllStructGetData($stToken, 1) If Not @error And $aRet <> 0 Then Return True EndIf Return False EndFunc ;==>_LogonUser Any assistance, suggestions or idea's would be helpful.
I'm working on a script to copy a subset of files and folders from a PC to a server. I'm using the extended info from DirGetSize to show how many files and folders and total size that will be copied (copy being done by RoboCopy). Then I run DirGetSize against the destination when the copy is done to compare against the DirGetSize from the copy source so I can know if anything got skipped. I'm finding that a lot of stuff is getting skipped. This lead me to realize that it's because DirGetSize is including files and folders that are hidden and/or system, and I'm excluding these in RoboCopy. Is there anyway to excluded these from DirGetSize? I've been unable to find a UDF as yet, and I'd like to do something a little more elegant than piping the output from DIR into a file and reading that back.
for some reason when I run this command with run as in autoit it returns access is denied. but when I run the same thing in an elevated command shell it works fine. Im not sure where I am messing up.
global $rtech,$rcred, $IP $rtech = inputbox("","username") $rcred = InputBox("","password") $ip = inputbox("","enter IP") $pid = Runas ($rtech,"mhs", $rcred, 2 ,@ComSpec & ' /c reg query \\' & $ip & '"\hklm\software\microsoft\windows\currentversion\group policy\state\machine"|findstr /i "disting"', @SystemDir, @SW_hide, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($pid) If @error Then ExitLoop WEnd While 1 $line &= StderrRead($pid) If @error Then ExitLoop WEnd MsgBox(0, "", $line)