11 Commits

Author SHA1 Message Date
34c57552f1 Add renovate.json 2026-01-05 13:48:28 +00:00
43db46bcca feat(migration): Migrate to Gitea 2026-01-05 13:42:22 +00:00
2a31da6305 📝 Remove section on now-defunct mailing list 2020-08-25 18:00:18 +01:00
db150a3973 Automatic update checking
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 23:17:24 +01:00
ab72c8c2ba Add optional -Encoding flag
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
20307da1e3 🔖 Update version to 2.2.0
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
5bdf885036 Add optional Delimiter flag
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-07 17:47:08 +01:00
9fb651f29d Update README.md 2020-07-04 19:32:53 +01:00
218f6cc3a5 Add mailing list info to README 2020-07-04 19:15:27 +01:00
aef71bb6c8 Create stale.yml 2020-06-01 15:46:39 +01:00
ead4d470f7 🐛 FIX: Fix hardcoded description for new teams
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-05-28 14:33:08 +01:00
9 changed files with 86 additions and 12 deletions

19
.archive/.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been marked as stale due to inactivity. If this issue is still ongoing, please leave a comment.'
stale-pr-message: 'This pull request has been marked as stale due to inactivity. If this PR is still ongoing, please leave a comment.'
stale-issue-label: 'status/stale'
stale-pr-label: 'status/stale'

1
.gitea/CODEOWNERS Normal file
View File

@@ -0,0 +1 @@
* @luke

View File

@@ -15,18 +15,16 @@ This module uses PowerShell, which is pre-installed on Windows. If you're not on
``` ```
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. 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> ### If you can't run non-signed scripts
<summary>If you can't run non-signed scripts</summary> If your policy requires scripts to be digitally signed, run
If your policy requires scripts to be digitally signed, run
```powershell ```powershell
Set-ExecutionPolicy Bypass -Scope Process Set-ExecutionPolicy Bypass -Scope Process
``` ```
then try running the command again. You may require administrative rights to change the Execution Policy. then try running the command again. You may require administrative rights to change the Execution Policy.
</details>
# Need help? # Need help?
If you need assistance, please try the following: If you need assistance, please try the following:
1. See the help documentation by running `Get-Help Import-TeamsUsers`. 1. See the help documentation by running `Get-Help Import-TeamsUsers`.
1. Check closed issues [here](https://github.com/luketainton/Import-TeamsUsers/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed). 1. Check closed issues [here](https://git.tainton.uk/repos/TeamsUserEnroller/issues?type=all&state=closed).
1. Open an issue [here](https://github.com/luketainton/Import-TeamsUsers/issues/new). 1. Open an issue [here](https://git.tainton.uk/repos/TeamsUserEnroller/issues/new).

View File

@@ -12,7 +12,7 @@
# RootModule = '' # RootModule = ''
# Version number of this module. # Version number of this module.
ModuleVersion = '2.1.1' ModuleVersion = '2.2.1'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View File

@@ -13,6 +13,12 @@ Function Import-TeamsUsers {
.PARAMETER Create .PARAMETER Create
If specified, create a new Group first, then add the users from the CSV file. If specified, create a new Group first, then add the users from the CSV file.
.PARAMETER Delimiter
If specified, overrides the default CSV delimiter of ','.
.PARAMETER Encoding
If specified, manually sets the encoding of the CSV file.
.EXAMPLE .EXAMPLE
Import-TeamsUsers -File "users.csv" Import-TeamsUsers -File "users.csv"
@@ -24,23 +30,70 @@ Function Import-TeamsUsers {
[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")] [parameter(Mandatory=$false, position=2, ParameterSetName='Params', HelpMessage="Create new Teams group")]
[switch]$Create [switch]$Create,
[parameter(Mandatory=$false, position=3, ParameterSetName='Params', HelpMessage="Override default CSV delimiter")]
[string]$Delimiter,
[parameter(Mandatory=$false, position=4, ParameterSetName='Params', HelpMessage="Manually set CSV encoding")]
[string]$Encoding
) )
Begin { Begin {
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
##### CHECK FOR NEW VERSION #####
Try {
# Get information from GitHub Releases
$releases = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/luketainton/TeamsUserEnroller/releases";
$rel = $releases[0];
$latest_version = $rel.tag_name -replace 'v', '';
$latest_version_changes = $rel.body;
# Get currently installed version
$current_version = (Get-Module TeamsUserEnroller | Select-Object Version).Version;
# Compare versions and alert user if newer version available
if ($current_version -lt $latest_version) {
Write-Host -ForegroundColor Yellow "A new version of TeamsUserEnroller has been released!";
Write-Host -ForegroundColor Yellow "Latest version: $latest_version";
Write-Host -ForegroundColor Yellow "Installed version: $current_version";
Write-Host -ForegroundColor Yellow "`n$latest_version_changes";
$Consent = Read-Host -Prompt "`nWould you like to update now? [y/N]"
If ($Consent -eq "y" -Or $Consent -eq "Y") {
Update-Module -Name TeamsUserEnroller -RequiredVersion "2.2.0";
$after_update_ver = (Get-Module TeamsUserEnroller | Select-Object Version).Version;
if ($after_update_ver -eq $latest_version) {
Write-Host -ForegroundColor Green "Update completed.";
} Else {
Write-Host -ForegroundColor Red "Update failed. Please update manually.";
}
}
}
} Catch {
Write-Host -ForegroundColor Red "An error occurred while checking for updates. Continuing.";
}
##### IMPORT CSV FILE ##### ##### IMPORT CSV FILE #####
Try { Try {
$Users = Import-CSV $File $ImportCmd = "Import-CSV $File"
If ($Delimiter) { $ImportCmd = $ImportCmd + " -Delimiter $Delimiter" }
If ($Encoding) { $ImportCmd = $ImportCmd + " -Encoding $Encoding" }
$Users = Invoke-Expression $ImportCmd
} Catch { } Catch {
Write-Host -ForegroundColor Red "$File is not a valid CSV file." Write-Host -ForegroundColor Red "$File is not a valid CSV file."
Exit
} }
##### CHECK MODULE IS INSTALLED AND IMPORTED ##### ##### CHECK MODULE IS INSTALLED AND IMPORTED #####
if (Get-Module -ListAvailable -Name MicrosoftTeams) { if (Get-Module -ListAvailable -Name MicrosoftTeams) {
Import-Module -Name MicrosoftTeams try {
$Email = (Connect-MicrosoftTeams -Verbose:$false).Account Import-Module -Name MicrosoftTeams
$Email = (Connect-MicrosoftTeams -Verbose:$false).Account
} Catch {
Write-Host -ForegroundColor Red "There was an error during authentication."
Write-Host "If you're not on Windows and use Multi-Factor Authentication, please manually pass the MFA check in your browser, then try again."
Exit
}
} else { } else {
Write-Host -ForegroundColor Red "Module MicrosoftTeams doesn't exist. Please run 'Install-Module -Name MicrosoftTeams' and retry." Write-Host -ForegroundColor Red "Module MicrosoftTeams doesn't exist. Please run 'Install-Module -Name MicrosoftTeams' and retry."
Exit Exit
@@ -59,7 +112,7 @@ Function Import-TeamsUsers {
} Elseif ($NewTeamPriv -Eq "r") { } Elseif ($NewTeamPriv -Eq "r") {
$NewTeamVis = "Private" $NewTeamVis = "Private"
} }
$NewTeam = New-Team -DisplayName $NewTeamName -MailNickName $NewTeamName -Description "Testing team creation from PowerShell" -Visibility $NewTeamVis $NewTeam = New-Team -DisplayName $NewTeamName -MailNickName $NewTeamName -Description $NewTeamDesc -Visibility $NewTeamVis
$GroupId = $NewTeam.GroupId $GroupId = $NewTeam.GroupId
} Else { } Else {
##### GET USER'S TEAMS ##### ##### GET USER'S TEAMS #####

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}