ive been struggling with this for a wee while now.
I am looking at using dynamic distribution groups.
I want to include all users with an "external" suffix at the end of their display naes. (this could als be used to exclude.)
Issues
DDGs do not accept a wild card prefix. it would accept (displayname -eq "john.doe*)" but not (dispalyname -eq *external).
powershell doesnt accept the employee type feild ( could have just filled that in and pointed at that)
-unable to add a mailgroup to the dynamic dg.
this is exchange online and fully cloud tenant
Attempts
i can add single users by smtpaddress but i would like to add a group of people
i have created a security group that i was hoping to pull the smtp from and pipe into the recipient filter.
this is for trying to add users of a dynamic security group to the distribution group
$groupname = "groupname" $external = Get-AzureADGroupMember -ObjectId "objectnumber" $externalsmtp = $external.UserPrincipalName $contractorsmtp | Foreach {Set-DynamicDistributionGroup "externalusersemail" -RecipientFilter {PrimarySmtpAddress -eq '$_.UserPrincipalName'}}
Any help would be appreciated.
I am looking for something simple and i think ive gone down a bad rabbit hole.
I would have rather done something like below. but nope :( ive also tried other
-RecipientFilter {-not(displayName -eq "*External*")
Related
Need assistance in getting the summary of user domains from sentinel signinglogs.
SigninLogs
| where AppId == "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
| extend UserDomains = split(UserPrincipalName,'#')[1]
| summarize TotalAttempts = count(), Failed=countif(ResultType !=0), Succeded=countif(ResultType ==0), LastAttempt = max(TimeGenerated), FirstAttempt = min(TimeGenerated), CountofUniqueID = dcount(UserPrincipalName), DomainCount = dcount(tostring(UserDomains))
The result has most of the information I need. However, I need little bit more clarity.
The objective of this report is to understand how may external users are consuming this applications and from which all domains they are accessing. So I need to make a summary based on internal users and external users.
How can I get the the count of all signed in users who are having a domain name ending with *mydomain.com (covering the root domain and child domains)
How can I get the the count of user domains specific to external users, ie the unique user domains - internal user domains (anything ending with *mydomain.com)
Is there a way to concatenate all the external domains with ";" as a delimiter ? In PowerShell, we use -join ";". Anything similar for KQL?
Appreciate your help on this.
Can anyone suggest a reasonably practical and efficient way to load 1.2 million test items into a SharePoint Online list?
Background: We've decided to build a new application on top of SharePoint Online. Other application architecture options have all proved non-viable for various reasons. The application will use several SharePoint lists for persistence, one of which will be large, about 1.2 million items at peak. (Yes, we're planning ways to handle the 5000 item view limit.) To test viability of the architecture (including those view limit tactics) we need to create 1.2M test items in a list. Nothing we've tried has been practical:
Tried making POST calls to the REST API, with 5 concurrent threads so it will finish in a reasonable time. This fails after a bit with a HTTP 429 "Too many requests".
Tried uploading a spreadsheet with 1.2M rows. This fails at 130K entries each time, and I don't see a practical way to either upload / append to an existing list, nor to append items from one list to another existing list.
Tried running a Workflow (SharePoint 2013 variety, if that matters). This works but runs way too slow single threaded and I'm hesitant to try multiple concurrent workflows because this is a shared environment and if I trash the server that would be way not good.
Thanks in advance for any pointers!
You could try to use pnp powershell to add more than 1 million items.
$username = "amos#contoso.onmicrosoft.com"
$password = "password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/dev -Credentials $cred
$ListName ="testn"
for($i=0;$i -lt 1000001;$i++){
Add-PnPListItem -List $ListName -Values #{"Title" = "test";}
}
Fastest way to load and process items from SPO using PnPPowershell goes something like following. Idea is to not initialize the items collection in any variable and directly process the items by page size.
Get-PnpListItem -List "{ListName}" -Fields "Field1","Field2","Fieldn" -PageSize 5000 | % {$i=0}{
% {$i=0}{
Do not move { to next line, I know it's weird but if you move, then good luck.
$item = $_
#Do your stuff with $item
Write-Host $item.Id
}
I'm attempting to run an LDAP filter to return all users within a group. Pretty simple, and there are hundreds of Stack Overflow questions which already provide example queries. However the one I'm using is basic, and returns nothing when run in Powershell.
What I've Tried
Get-ADUser -LDAPFilter "(&(objectclass=user)(objectcategory=person)(memberOf=CN=MyGroup,OU=Users,DC=MyDomain,DC=com))"
I've also tried "CN=Users" instead of "OU=Users
Where "MyGroup" is located in the OU:
"MyDomain" (Forest) > "Users" (OU) > "MyGroup" (CN)
Any ideas what I'm doing wrong, and why none of the 100-200 members of the "MyGroup" are being returned?
Cross-post: https://serverfault.com/q/978336/536173
TL;DR of the most upvoted answer:
Use (memberOf:1.2.840.113556.1.4.1941:=<GROUP_DN>) to query for group memberships recursively.
I have almost 20 resources in azure, 4 of them have been given Tags #
{"Office1work"="work"}
{"Office2practice"="Practice"}
{"Office3practice"="Practice"}
{"Office4practice"="Practice"}
Now I want to get the resources whose Tag names start with the keyword "Office".
I know to get a resource by a TagName,for example "hello", I simply use the following command,
get-azureRmResource -TagName "Hello"
How can I use the -Tagname property of get-azurermresource to give me all resources whose tags are starting with the keyword "Office" ?
Or is there any other good method to get all resources whose Tags start with a particular string?
Thanks :)
You can use this code snippet:
$resources = Get-AzureRmResources
$resources.foreach{ if ($PSItem.tags.keys -match '^Office') { $PSItem } }
First you get all the resources in the subscription, then you filter out all the resource whose tags do not match the 'Office' "expression".
as #LotPings points out, it would probably make more sense to filter without saving to a temporary variable:
$resources = Get-AzureRmResources|Where-Object {$_.tags.keys -match "^Office"}
Also, I didnt notice you were asking for a starts with filter, so you should use ^Office as a more strict filter (if you need to).
Does somebody know how I can import all members of one group into another in GitLab, rather than doing it manually one by one?
The only native feature which comes close is in lib/tasks/gitlab/bulk_add_permission.rake, which is mentioned in "User management"
# omnibus-gitlab
sudo gitlab-rake gitlab:import:all_users_to_all_groups
# installation from source
bundle exec rake gitlab:import:all_users_to_all_groups RAILS_ENV=production
You could take that as a model to develop our own task.
I am not aware of such a feature. But you can script it with the API. We use it here to add all users to one single group (all users to all groups is not feasible for our case).
Helpful documentation: http://doc.gitlab.com/ce/api/README.html, http://doc.gitlab.com/ce/api/users.html and http://doc.gitlab.com/ce/api/groups.html
There is also a respond to another question that might be helpful and lists also various modules for various programming languages: Is there a way to add users automatically into gitlab?
I was looking for a solution to Assign all Gitlab users to one particular group.
Here's the solution:
Create this file:
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/finder_import.rake
With this content:
namespace :gitlab do namespace :finder do
desc "GitLab | Add all users to group Colaboradores (admin users are added as owners)"
task importall: :environment do |t, args|
user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id)
groups = Group.where(name: "Colaboradores")
puts "Importing #{user_ids.size} users into #{groups.size} groups"
puts "Importing #{admin_ids.size} admins into #{groups.size} groups"
groups.each do |group|
puts "Importing into #{group.name}"
group.add_users(user_ids, GroupMember::DEVELOPER)
group.add_users(admin_ids, GroupMember::OWNER)
end
end
end end
Run this command:
gitlab-rake gitlab:finder:importall