Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ead4d470f7 | |||
| c383fb840d | |||
| 1d7e7c71b7 | |||
| cb3d1eb3bd | |||
| 42fdf856b5 | |||
| 6b13a2d1fc | |||
| 2056117ea7 | |||
| 0f8b9dfdea | |||
| eba04be5f3 | |||
| a88fb454fa | |||
| 44a90b2c52 |
9
.github/issue-branch.yml
vendored
Normal file
9
.github/issue-branch.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
mode: auto
|
||||||
|
silent: false
|
||||||
|
branchName: short
|
||||||
|
branches:
|
||||||
|
- label: feature
|
||||||
|
prefix: feature/
|
||||||
|
- label: bug
|
||||||
|
prefix: bug/
|
||||||
|
autoCloseIssue: true
|
||||||
14
.github/workflows/autobranch.yml
vendored
Normal file
14
.github/workflows/autobranch.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [assigned]
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create_issue_branch_job:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create Issue Branch
|
||||||
|
uses: robvanderleek/create-issue-branch@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
14
.github/workflows/sponsors.yml
vendored
Normal file
14
.github/workflows/sponsors.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Label sponsors
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened]
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: is-sponsor-label
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: JasonEtco/is-sponsor-label-action@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -4,7 +4,7 @@ A Powershell module that imports users from a CSV into a Microsoft Teams group.
|
|||||||
# Setting up your device
|
# Setting up your device
|
||||||
This module uses PowerShell, which is pre-installed on Windows. If you're not on Windows, please [download **PowerShell Core**](https://github.com/PowerShell/PowerShell/releases).
|
This module uses PowerShell, which is pre-installed on Windows. If you're not on Windows, please [download **PowerShell Core**](https://github.com/PowerShell/PowerShell/releases).
|
||||||
1. Open PowerShell as an administrator.
|
1. Open PowerShell as an administrator.
|
||||||
1. Install this module by running `Install-Module -Name TeamsUsersEnroller`.
|
1. Install this module by running `Install-Module -Name TeamsUserEnroller`.
|
||||||
|
|
||||||
# Running the script
|
# Running the script
|
||||||
1. Create a CSV file containing your users and their desired roles. The first line must be the headers `email,role`, for example:
|
1. Create a CSV file containing your users and their desired roles. The first line must be the headers `email,role`, for example:
|
||||||
@@ -13,7 +13,7 @@ This module uses PowerShell, which is pre-installed on Windows. If you're not on
|
|||||||
jbloggs@example.com,owner
|
jbloggs@example.com,owner
|
||||||
user@example.com,member
|
user@example.com,member
|
||||||
```
|
```
|
||||||
1. Run `Import-TeamsUsers -File <FILE>`, where `<FILE>` is the path to the CSV file.
|
1. Run `Import-TeamsUsers -File <FILE>`, where `<FILE>` is the path to the CSV file. You can add the `-Create` flag if you want to create a new team first.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>If you can't run non-signed scripts</summary>
|
<summary>If you can't run non-signed scripts</summary>
|
||||||
@@ -22,7 +22,7 @@ This module uses PowerShell, which is pre-installed on Windows. If you're not on
|
|||||||
```powershell
|
```powershell
|
||||||
Set-ExecutionPolicy Bypass -Scope Process
|
Set-ExecutionPolicy Bypass -Scope Process
|
||||||
```
|
```
|
||||||
then try running the command again. You may require administrative rights to do change the Execution Policy.
|
then try running the command again. You may require administrative rights to change the Execution Policy.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
# Need help?
|
# Need help?
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# RootModule = ''
|
# RootModule = ''
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '2.0.0'
|
ModuleVersion = '2.1.2'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|||||||
@@ -10,19 +10,32 @@ Function Import-TeamsUsers {
|
|||||||
.PARAMETER File
|
.PARAMETER File
|
||||||
The path to the CSV file that contains your users. Can either be an absolute path or relative path.
|
The path to the CSV file that contains your users. Can either be an absolute path or relative path.
|
||||||
|
|
||||||
|
.PARAMETER Create
|
||||||
|
If specified, create a new Group first, then add the users from the CSV file.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Import-TeamsUsers -File "users.csv"
|
Import-TeamsUsers -File "users.csv"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Import-TeamsUsers -Create -File "users.csv"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[parameter(Mandatory=$true, position=1, ParameterSetName='Params', HelpMessage="Specify CSV file")]
|
[parameter(Mandatory=$true, position=1, ParameterSetName='Params', HelpMessage="Specify CSV file")]
|
||||||
[string]$File
|
[string]$File,
|
||||||
|
[parameter(Mandatory=$false, position=2, ParameterSetName='Params', HelpMessage="Create new Teams group")]
|
||||||
|
[switch]$Create
|
||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
##### IMPORT CSV FILE #####
|
##### IMPORT CSV FILE #####
|
||||||
|
Try {
|
||||||
$Users = Import-CSV $File
|
$Users = Import-CSV $File
|
||||||
|
} Catch {
|
||||||
|
Write-Host -ForegroundColor Red "$File is not a valid CSV file."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
##### CHECK MODULE IS INSTALLED AND IMPORTED #####
|
##### CHECK MODULE IS INSTALLED AND IMPORTED #####
|
||||||
if (Get-Module -ListAvailable -Name MicrosoftTeams) {
|
if (Get-Module -ListAvailable -Name MicrosoftTeams) {
|
||||||
@@ -35,6 +48,20 @@ Function Import-TeamsUsers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
|
If ($Create) {
|
||||||
|
##### CREATE NEW TEAM #####
|
||||||
|
Clear-Host
|
||||||
|
$NewTeamName = Read-Host -Prompt "Name of the new group"
|
||||||
|
$NewTeamDesc = Read-Host -Prompt "Group description"
|
||||||
|
$NewTeamPriv = Read-Host -Prompt "P[u]blic or P[r]ivate?"
|
||||||
|
If ($NewTeamPriv -Eq "u") {
|
||||||
|
$NewTeamVis = "Public"
|
||||||
|
} Elseif ($NewTeamPriv -Eq "r") {
|
||||||
|
$NewTeamVis = "Private"
|
||||||
|
}
|
||||||
|
$NewTeam = New-Team -DisplayName $NewTeamName -MailNickName $NewTeamName -Description $NewTeamDesc -Visibility $NewTeamVis
|
||||||
|
$GroupId = $NewTeam.GroupId
|
||||||
|
} Else {
|
||||||
##### GET USER'S TEAMS #####
|
##### GET USER'S TEAMS #####
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host -ForegroundColor Green "Getting your teams - please wait"
|
Write-Host -ForegroundColor Green "Getting your teams - please wait"
|
||||||
@@ -52,6 +79,7 @@ Function Import-TeamsUsers {
|
|||||||
Write-Host "Teams that you own:"
|
Write-Host "Teams that you own:"
|
||||||
$EligibleTeams | ForEach-Object {[PSCustomObject]$_} | Format-Table 'GroupId', 'DisplayName' -AutoSize
|
$EligibleTeams | ForEach-Object {[PSCustomObject]$_} | Format-Table 'GroupId', 'DisplayName' -AutoSize
|
||||||
$GroupId = Read-Host -Prompt "GroupId of the desired group"
|
$GroupId = Read-Host -Prompt "GroupId of the desired group"
|
||||||
|
}
|
||||||
|
|
||||||
##### ENROL USERS #####
|
##### ENROL USERS #####
|
||||||
$global:UsersAdded = 0;
|
$global:UsersAdded = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user