user-accounts

How can I get a list Local Windows Users (Only the Users that appear in the windows Logon Screen)

被刻印的时光 ゝ 提交于 2019-11-27 04:50:47
问题 How can I get a list of Local Windows Users (Only the Users that appear in the windows Logon Screen) I have tried many methods using Windows Principle library & WMI Select commands. I keep getting Administrator, Guest & some other bizarre accounts (VUSRNEIL-DELL, $HOMEGROUPUSER, ASPNET...etc.) Neither of these 3 user accounts appear on the Logon screen. How can I Differentiate between these user types? I am coding in C# 回答1: Just add a reference to System.Management in a Console Application

How to add Sysadmin login to SQL Server?

只愿长相守 提交于 2019-11-27 02:34:59
问题 I have installed SQL Server 2008 using Windows Authentication in my laptop for my own use. I want to add Sysadmin account/role using SQL Server Login type. I checked this post, but it's not showing what I need. How can I add the sysadmin account? By right shouldn't it be the default role/login? 回答1: sysadmin is a server role; it can be applied to any login. When installing SQL Server a login sa is created with this privilege; you can specify the password when you're installing SQL Server. Or

PHP and MySQL Select a Single Value

巧了我就是萌 提交于 2019-11-27 01:49:38
问题 I'd like to know how to select a single value from my MySQL table. The table includes columns username and id amongst others ( id is auto-increment and username is unique). Given the username, I want to set a session variable $_SESSION['myid'] equal to the value in the id column that corresponds to the given username. Here's the code that I've already tried: session_start(); $name = $_GET["username"]; $sql = "SELECT 'id' FROM Users WHERE username='$name'"; $result = mysql_query($sql); $value

PHP Count Logged-In Users

独自空忆成欢 提交于 2019-11-27 01:43:06
问题 I'm having trouble figuring out how I can count the number of logged-in users in my application. What I have: When a user logs in, they get a session (which is used when the user wants to visit a protected page) and the IsLoggedIn column for the user in the users table is set to 1 to indicate that the user is logged in. When the user logs out, the value is set back to 0. Counting the number of 1s in the users table makes it easy to return the number of users logged-in. But... The Problem: If

powershell - list local users and their groups

[亡魂溺海] 提交于 2019-11-26 19:51:18
问题 I'd like to have a report with all the local users and their relative groups (users, power users, administrators and so on. I get the users in this way: $adsi = [ADSI]"WinNT://." $adsi.psbase.children | where {$_.psbase.schemaClassName -match "user"} | select @{n="Name";e={$_.name}} but I don't know how to retrieve their groups. Thanks in advance. 回答1: $adsi = [ADSI]"WinNT://$env:COMPUTERNAME" $adsi.Children | where {$_.SchemaClassName -eq 'user'} | Foreach-Object { $groups = $_.Groups() |

create local user account

て烟熏妆下的殇ゞ 提交于 2019-11-26 14:16:40
问题 i have this code to create a local windows user public static bool CreateLocalWindowsAccount(string username, string password, string displayName, string description, bool canChangePwd, bool pwdExpires) { try { PrincipalContext context = new PrincipalContext(ContextType.Machine); UserPrincipal user = new UserPrincipal(context); user.SetPassword(password); user.DisplayName = displayName; user.Name = username; user.Description = description; user.UserCannotChangePassword = canChangePwd; user

How to grant full permission to a file created by my application for ALL users?

 ̄綄美尐妖づ 提交于 2019-11-26 12:04:57
问题 The tool I develop needs to grant access rights \"Full Control\" to a file created by it. It needs to be read, modified and deleted from all windows accounts and even possible future accounts. Could this be achieved? I know I can try this for a SPECIFIC_USER: FileSystemAccessRule rule = new FileSystemAccessRule(SPECIFIC_USER, FileSystemRights.FullControl, AccessControlType.Allow); FileSecurity fSecurity = File.GetAccessControl(filePath); fSecurity.SetAccessRule(rule); File.SetAccessControl

How do you run CMD.exe under the Local System Account?

半城伤御伤魂 提交于 2019-11-26 04:30:43
问题 I\'m currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to emulate this same behavior. Basically, I would like to run CMD.EXE under the Local System Account. I found information online which suggests lauching the CMD.exe using the DOS Task Scheduler AT command, but I received a Vista warning that \"due to security enhancements, this task will run at the time

Detect if running as Administrator with or without elevated privileges?

ⅰ亾dé卋堺 提交于 2019-11-26 04:03:55
I have an application that needs to detect whether or not it is running with elevated privileges or not. I currently have code set up like this: static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole (WindowsBuiltInRole.Administrator); } This works to detect if a user is an administrator or not, but doesn't work if running as an administrator without elevation. (For example in vshost.exe). How can I determine whether or not elevation is [already in force or] possible ?

What are all the user accounts for IIS/ASP.NET and how do they differ?

我是研究僧i 提交于 2019-11-26 02:24:10
Under Windows Server 2008 with ASP.NET 4.0 installed there is a whole slew of related user accounts, and I can't understand which one is which, how to they differ, and which one is REALLY the one that my app runs under. Here's a list: IIS_IUSRS IUSR DefaultAppPool ASP.NET v4.0 NETWORK_SERVICE LOCAL SERVICE. What is what? Kev This is a very good question and sadly many developers don't ask enough questions about IIS/ASP.NET security in the context of being a web developer and setting up IIS. So here goes.... To cover the identities listed: IIS_IUSRS: This is analogous to the old IIS6 IIS_WPG