How to list users and groups with Powershell?

How can I list local groups?

PS C:\Users\thufir> PS C:\Users\thufir> Get-WMIObject win32_operatingsystem   SystemDirectory : C:\WINDOWS\system32 Organization    : Microsoft BuildNumber     : 17134 RegisteredUser  : thufir SerialNumber    : 00330-62820-00000-AAOEM Version         : 10.0.17134    PS C:\Users\thufir> PS C:\Users\thufir> get-LocalGroupMember get-LocalGroupMember : The term 'get-LocalGroupMember' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + get-LocalGroupMember + ~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (get-LocalGroupMember:String) [], CommandNotFoundException     + FullyQualifiedErrorId : CommandNotFoundException  PS C:\Users\thufir> PS C:\Users\thufir> get-LocalGroup get-LocalGroup : The term 'get-LocalGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + get-LocalGroup + ~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (get-LocalGroup:String) [], CommandNotFoundException     + FullyQualifiedErrorId : CommandNotFoundException  PS C:\Users\thufir> PS C:\Users\thufir> 

Running compmgmt.msc will bring up a GUI listing local users and groups, of course. This is from a Surface 3.

I’ve tried solutions from:

https://stackoverflow.com/q/4548476/262852

Select users with only one role

How can i select all users wich have only 1 role. For example i got 4 users:

User 1:

Role 1, Role 2

User 2:

Role 1

User 3:

Role 1, Role 2

User 4:

Role 1

How can i retrieve a list of users wich only got Role 1? But not Role 2.

$  query = db_select('users', 'u'); $  query->leftJoin('users_roles', 'ur', 'u.uid = ur.uid'); $  query->leftJoin('field_data_field_full_name', 'n', 'u.uid = n.entity_id'); $  query->condition(...); $  query->fields('u', array('uid','name','picture')); $  query->fields('n', array('field_full_name_value')); $  result = $  query->execute()->fetchAll() 

EDIT:

SELECT  u.uid AS uid, u.name AS name,  u.picture AS picture, n.field_full_name_value AS field_full_name_value, f.field_function_value AS field_function_value, pi.field_phone_intern__value AS field_phone_intern__value, ur.rid AS rid, COUNT(*) AS rolecount FROM `dev_drupal_wurth-intranet`.users u  LEFT OUTER JOIN `dev_drupal_wurth-intranet`.users_roles ur ON u.uid = ur.uid  LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_full_name n ON u.uid = n.entity_id  LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_function f ON u.uid = f.entity_id  LEFT OUTER JOIN `dev_drupal_wurth-intranet`.field_data_field_phone_intern_ pi ON u.uid = pi.entity_id  GROUP BY u.uid; 

This give me the result all the users and their number of roles. Now i tried to filter on this role count with ‘WHERE rolecount = 1’ but this just gives and sql error.

I’m not very advanced in sql :), still learning.

Thx

How to get All Users in User Profile Services Sharepoint 2013 Using CSOM

I need some function like bellow on CSOM. could you help me ?


if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $  null) {      Add-PSSnapin "Microsoft.SharePoint.PowerShell"  }   $  site = new-object Microsoft.SharePoint.SPSite("<<WebApplicationSiteUrl>>");   $  ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($  site);    $  ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($  ServiceContext)     $  AllProfiles = $  ProfileManager.GetEnumerator()    foreach($  profile in $  AllProfiles)   {       $  DisplayName = $  profile.DisplayName       $  AccountName = $  profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value       write-host "Profile for account ", $  AccountName }   write-host "Finished."  $  site.Dispose() 

FTP server – users can only upload certain files

Is there an FTP server for Linux where I can configure a user’s permissions to only upload certain files by filename and only those files?

Example: in the image folders only allow files with a png or jpg extension, in another folder only files with the name of list.txt documents.txt content.txt

If not I can always delete them afterward, but would prefer to do it right away.

Custom JS produces different results based on user’s permission level in SP 2013

HELP! I understand this question is a bit vague, however, that is because I have never run into this issue before and I have no idea where to start.

Anyone who can share a similar experience and what they did to solve the problem is a Godsend

I have custom JS for an uploader that ingests excel files, parses the data and put that data into SharePoint lists. It uses the following libraries: xlsx.core.min.js, xlsx.full.min.js, and jquery.min.js.

This uploader behaves differently depending upon the permission level of the person attempting to do the upload. IE – you must have full control or be an SCA for it to work as intended. None of the scripts make a reference to other subsites, everything is local. I have never heard of this before and am having trouble finding help online for this topic.

Any takers??

If we are allowing anonymous users to register inside our web site, how we can prevent hackers from occupying others’ email address

I am planning to start a new asp.net core MVC web application. One of the features we are having is that anonymous users can register inside our web application by entering their email addresses. then our system will send them a confirmation email, to activate their accounts.

Now by default the system will show error message, in-case a user try to register using existing email address, even if the existing email address was not confirmed. now this will pose a major problem in our system, is that hackers can use others’ email addressees, and prevent them from registering inside our web application. Our web application is a CRM-like for real estate companies, and hackers can try to add as many email addresses has they want, they can get these email addresses from the companies’ web sites such as info@.., contact@..., admin@.. , etc. So is there any problem if I do the following modifications:-

  1. If the user did not confirm the email address in 1 hour, then the system will automatically remove his email address?
  2. When I want to check if an email address is unique to check only the approved email addresses.