Skip to content

Commit

Permalink
Added Example Script, and upped version
Browse files Browse the repository at this point in the history
Added Get-AllTenants-AutoPilotDevices and upped version
  • Loading branch information
BNWEIN committed Sep 30, 2024
1 parent 1b54fc2 commit b8cf6c1
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CIPPAPIModule/CIPPAPIModule.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'CIPPAPIModule.psm1'

# Version number of this module.
ModuleVersion = '1.1.6'
ModuleVersion = '1.1.7'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
41 changes: 41 additions & 0 deletions Docs/Add-CIPPSharePointSite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Add-CIPPSharePointSite
## SYNOPSIS
Adds a new SharePoint site to the specified customer tenant.
## DESCRIPTION
The Add-CIPPSharePointSite function creates a new SharePoint site with the specified parameters.
It supports different site designs and templates.
# PARAMETERS

## **-CustomerTenantID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the customer tenant where the SharePoint site will be added. This parameter is mandatory.

## **-DisplayName**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The display name of the SharePoint site. This parameter is mandatory.

## **-Description**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The description of the SharePoint site. This parameter is mandatory.

## **-Owner**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The owner of the SharePoint site. Should be a valid user principal name (UPN). This parameter is mandatory.

## **-SiteDesign**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-Showcase-Blue?color=5547a8)\
The design of the SharePoint site. Valid values are 'Topic', 'Showcase', 'Blank', and 'Custom'. The default value is 'Showcase'. This parameter is optional.

## **-TemplateName**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-Communication-Blue?color=5547a8)\
The template of the SharePoint site. Valid values are 'Communication' and 'Team'. The default value is 'Communication'. This parameter is optional.

#### EXAMPLE 1
```powershell
PS > Add-CIPPSharePointSite -CustomerTenantID "166cc908-10b2-405f-a00b-03006c430c9c" -DisplayName "Project Site" -Description "Site for project collaboration" -Owner "owner@domain.com"
```
#### EXAMPLE 2
```powershell
PS > Add-CIPPSharePointSite -CustomerTenantID "domain.com" -DisplayName "Project Site" -Description "Site for project collaboration" -Owner "owner@domain.com"
```

36 changes: 36 additions & 0 deletions Docs/Add-CIPPTeam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Add-CIPPTeam
## SYNOPSIS
Adds a new team site to the specified customer tenant.
## DESCRIPTION
The Add-CIPPTeam function creates a new team site in the specified customer tenant using the provided display name, description, visibility, and owner.
# PARAMETERS

## **-CustomerTenantID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the customer tenant where the team site will be added. Can be the tenant ID or default domain name.

## **-DisplayName**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The display name of the new team site.

## **-Description**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
A description for the new team site.

## **-Visibility**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The visibility setting for the new team site (e.g., Public or Private).

## **-Owner**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The owner of the new team site. Should be a valid user principal name (UPN) with a teams license assigned.

#### EXAMPLE 1
```powershell
PS > Add-CIPPTeam -CustomerTenantID "9d606831-a394-4d1a-b508-260f428807a4" -DisplayName "Engineering Team" -Description "Team for engineering department" -Visibility "Private" -Owner "john.doe@example.com"
```
#### EXAMPLE 2
```powershell
PS > Add-CIPPTeam -CustomerTenantID "exampleTenant.onmicrosoft.com" -DisplayName "Marketing Team" -Description "Team for marketing department" -Visibility "Public" -Owner "Jane.doe@example.com"
```

32 changes: 32 additions & 0 deletions Docs/Add-CIPPUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ The job title of the user.
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
The mobile phone number of the user.

## **-BusinessPhone**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
The business phone number of the user.

## **-StreetAddress**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
The street address of the user.
Expand All @@ -77,14 +81,42 @@ The postal code of the user.
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
The company name of the user.

## **-Manager**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
The manager of the user. Either the UserPrincipalName(UPN) or the ID of the manager.

## **-MustChangePass**
> ![Foo](https://img.shields.io/badge/Type-Boolean-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-True-Blue?color=5547a8)\
Specifies whether the user must change their password on first login. Default value is $true.

## **-ScheduledFor**
> ![Foo](https://img.shields.io/badge/Type-DateTime-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Specifies the date and time when the user should be added. If not specified, the user will be added immediately. Input should be a valid datetime object. Will be converted to Unix time.

## **-SendResultsToEmail**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the email address specified in the notification settings of your CIPP instance.

## **-SendResultsToPSA**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the PSA system specified in the notification settings of your CIPP instance.

## **-SendResultsToWebhook**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the webhook specified in the notification settings of your CIPP instance.

#### EXAMPLE 1
```powershell
PS > Add-CIPPUser -CustomerTenantID "7ced1621-b8f7-4231-868c-bc6b1a2f1778" -DisplayName "John Doe" -UserName "johndoe" -FirstName "John" -LastName "Doe" -Domain "example.com" -UsageLocation "US"
Adds a user with the specified details to the customer tenant with ID "7ced1621-b8f7-4231-868c-bc6b1a2f1778". The user's display name is "John Doe", username is "johndoe", first name is "John", last name is "Doe", domain is "example.com", and usage location is "US".
```
#### EXAMPLE 2
```powershell
PS > Add-CIPPUser -CustomerTenantID "7ced1621-b8f7-4231-868c-bc6b1a2f1778" -DisplayName "Jane Smith" -UserName "janesmith" -FirstName "Jane" -LastName "Smith" -Domain "example.com" -UsageLocation "US" -Manager "managerPerson@example.com" -ScheduledFor ((Get-Date).AddDays(1)) -SendResultsToEmail
Adds a user with the specified details to the customer tenant with ID "7ced1621-b8f7-4231-868c-bc6b1a2f1778".
The user's display name is "Jane Smith", username is "janesmith", first name is "Jane", last name is "Smith", domain is "example.com", and usage location is "US". The user's manager is "managerPerson@example.com".
The user will be added one day from the current date. The results of the scheduled task will be sent to the email address specified in the notification settings of your CIPP instance.
```

2 changes: 1 addition & 1 deletion Docs/Get-CIPPLogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Get-CIPPLogs function retrieves logs from the CIPP API by invoking the "/api
Accepts any of: debug,info,warn,error,critical,alert. If DateFilter is not specified alongside, it assumes current date in local time.

## **-DateFilter**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-(Get-Date -Format "yyyyMMdd")-Blue?color=5547a8)\
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-(Get-Date -Format 'yyyyMMdd')-Blue?color=5547a8)\
Date in "yyyyMMdd" format. This should be in the time zone of your CIPP instance (default UTC).

#### EXAMPLE 1
Expand Down
119 changes: 119 additions & 0 deletions Docs/New-CIPPUserOffboarding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# New-CIPPUserOffboarding
## SYNOPSIS
Offboards a user from a specified customer tenant.
## DESCRIPTION
The New-CIPPUserOffboarding function automates the offboarding process for a user in a specified customer tenant.
It provides various options to customize the offboarding process, including forwarding emails, converting the mailbox
to a shared mailbox, disabling sign-in, removing licenses, and more. It is also possible to schedule the offboarding for a later date.
# PARAMETERS

## **-CustomerTenantID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the customer tenant from which the user is being offboarded. This parameter is mandatory.

## **-User**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The username of the user being offboarded. UserPrincipalName(UPN) should be used. This parameter is mandatory.

## **-OutOfOffice**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Sets an out-of-office message for the user. This parameter is optional.

## **-ForwardTo**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Forwards the user's emails to another address. This parameter is optional.

## **-ForwardKeepCopyInMailbox**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Keeps a copy of forwarded emails in the user's mailbox. This parameter is optional.

## **-OnedriveAccessTo**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Grants access to the user's OneDrive to another user. UserPrincipalName(UPN) should be used. This parameter is optional.

## **-MailboxAccessNoAutomap**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Grants access to the user's mailbox without automapping. UserPrincipalName(UPN) should be used. This parameter is optional.

## **-MailboxAccessAutomap**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Grants access to the user's mailbox with automapping. UserPrincipalName(UPN) should be used. This parameter is optional.

## **-ConvertToSharedMailbox**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Converts the user's mailbox to a shared mailbox. This parameter is optional.

## **-HideFromGAL**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Hides the user from the Global Address List (GAL). This parameter is optional.

## **-DisableSignIn**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Disables sign-in for the user. This parameter is optional.

## **-DeleteUser**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Deletes the user account. This parameter is optional.

## **-RemoveFromAllGroups**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Removes the user from all groups. This parameter is optional.

## **-CancelAllCalendarInvites**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Cancels all calendar invites for the user. This parameter is optional.

## **-RemoveAllLicenses**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Removes all licenses assigned to the user. This parameter is optional.

## **-ResetPassword**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Resets the user's password. This parameter is optional.

## **-RevokeAllSessions**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Revokes all active sessions for the user. This parameter is optional.

## **-RemoveAllMailboxRules**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Removes all mailbox rules for the user. This parameter is optional.

## **-RemoveAllMobileDevices**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Removes all mobile devices associated with the user. This parameter is optional.

## **-RemoveAllMailboxPermissions**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Removes all mailbox permissions for the user. This parameter is optional.

## **-ScheduledFor**
> ![Foo](https://img.shields.io/badge/Type-DateTime-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
Specifies the date and time when the user should be added. If not specified, the user will be offboarded immediately. Input should be a valid datetime object. Will be converted to Unix time. This parameter is optional.

## **-SendResultsToEmail**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the email address specified in the notification settings of your CIPP instance. This parameter is optional.

## **-SendResultsToPSA**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the PSA system specified in the notification settings of your CIPP instance. This parameter is optional.

## **-SendResultsToWebhook**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
Specifies whether to send the results of the scheduled task to the webhook specified in the notification settings of your CIPP instance. This parameter is optional.

#### EXAMPLE 1
```powershell
PS > New-CIPPUserOffboarding -CustomerTenantID "8ad00f9e-1953-47d1-897b-8fec4138cde7" -User "jdoe@domain.com" -DisableSignIn -RemoveAllLicenses -ConvertToSharedMailbox
This example immediately offboards the user "jdoe@domain.com" from the customer tenant with ID "8ad00f9e-1953-47d1-897b-8fec4138cde7", disables sign-in, removes all licenses, and converts the user's mailbox to a shared mailbox.
```
#### EXAMPLE 2
```powershell
PS > New-CIPPUserOffboarding -CustomerTenantID "8ad00f9e-1953-47d1-897b-8fec4138cde7" -User "jane.doe@domain.com" -DeleteUser -ScheduledFor ((Get-Date).AddDays(7)) -SendResultsToEmail
This example schedules the offboarding of the user "jane.doe@domain.com" from the customer tenant with ID "8ad00f9e-1953-47d1-897b-8fec4138cde7" for 7 days from the current date.
The results of the scheduled task will be sent to the email address specified in the notification settings of your CIPP instance.
```

25 changes: 25 additions & 0 deletions Docs/Remove-CIPPUser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Remove-CIPPUser
## SYNOPSIS
Removes a user from a specified tenant.
## DESCRIPTION
The Remove-CIPPUser function deletes a user identified by their UserID from a specified tenant identified by the CustomerTenantID.
It sends a request to the '/api/RemoveUser' endpoint to perform the deletion.
# PARAMETERS

## **-CustomerTenantID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the tenant from which the user will be removed. This parameter is mandatory.

## **-User**
> ![Foo](https://img.shields.io/badge/Type-Guid-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The unique identifier (GUID) or UserPrincipalName(UPN) of the user to be removed. This parameter is mandatory.

#### EXAMPLE 1
```powershell
PS > Remove-CIPPUser -CustomerTenantID "tenant123.domain.com" -UserID "e7402930-efc9-4ba8-a959-ae7fc6c15021"
```
#### EXAMPLE 2
```powershell
PS > Remove-CIPPUser -CustomerTenantID "3939eb14-06b3-4287-aea7-defe129c6741" -UserID "user@domaion.com"
```

Loading

0 comments on commit b8cf6c1

Please sign in to comment.