Skip to content

Commit

Permalink
Merge branch 'dev' into MakeAddPnPMicrosoft365GroupToSiteNotRequireUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamdsheth authored Oct 26, 2022
2 parents d7fc8c0 + 21b57cb commit 092bd86
Show file tree
Hide file tree
Showing 10 changed files with 8,866 additions and 49 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Contributors

- Jasper Beerens
- Aleksandr Sapozhkov [shurick81]
- James Eccles [jameseccles]
- Martin Lingstuyl [martinlingstuyl]
- Antti K. Koskela [koskila]
Expand Down
59 changes: 13 additions & 46 deletions documentation/Remove-PnPNavigationNode.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,30 @@ online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPNavigationNod
# Remove-PnPNavigationNode

## SYNOPSIS
Removes a menu item from either the quicklaunch or top navigation
Removes a menu item from either the quick launch or top navigation.

## SYNTAX

### Remove a node by ID (Default)
```powershell
Remove-PnPNavigationNode [-Identity] <NavigationNodePipeBind> [-Force]
[-Connection <PnPConnection>] [<CommonParameters>]
[-Connection <PnPConnection>]
```

### Remove node by Title
```powershell
Remove-PnPNavigationNode [-Location] <NavigationType> -Title <String> [-Header <String>] [-Force]
[-Connection <PnPConnection>] [<CommonParameters>]
[-Connection <PnPConnection>]
```

### All Nodes
```powershell
Remove-PnPNavigationNode [-All] [-Force] [-Connection <PnPConnection>]
[<CommonParameters>]
```

## DESCRIPTION

Allows to remove menu item from either the quicklaunch or top navigation.
Allows to remove menu item from either the quick launch or top navigation.

## EXAMPLES

Expand All @@ -43,35 +42,35 @@ Allows to remove menu item from either the quicklaunch or top navigation.
Remove-PnPNavigationNode -Identity 1032
```

Removes the navigation node with the specified id
Removes the navigation node with the specified id.

### EXAMPLE 2
```powershell
Get-PnPNavigationNode -Location Footer | Select-Object -First 1 | Remove-PnPNavigationNode -Force
```

Removes the first node of the footer navigation without asking for confirmation
Removes the first node of the footer navigation without asking for confirmation.

### EXAMPLE 3
```powershell
Remove-PnPNavigationNode -Title Recent -Location QuickLaunch
```

Will remove the recent navigation node from the quick launch in the current web after confirmation has been given that it should be deleted
Removes the recent navigation node from the quick launch in the current web after confirmation has been given that it should be deleted.

### EXAMPLE 4
```powershell
Remove-PnPNavigationNode -Title Home -Location TopNavigationBar -Force
```

Will remove the home navigation node from the top navigation bar without prompting for a confirmation in the current web
Removes the home navigation node from the top navigation bar in the current web without prompting for a confirmation.

### EXAMPLE 5
```powershell
Get-PnPNavigationNode -Location QuickLaunch | Remove-PnPNavigationNode -Force
```

Will remove all the navigation nodes from the quick launch bar without prompting for a confirmation in the current web
Removes all the navigation nodes from the quick launch bar in the current web without prompting for a confirmation.

## PARAMETERS

Expand All @@ -89,21 +88,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Expand Down Expand Up @@ -133,7 +117,7 @@ Accept wildcard characters: False
```
### -Header
{{ Fill Header Description }}
Obsolete.
```yaml
Type: String
Expand All @@ -147,7 +131,7 @@ Accept wildcard characters: False
```
### -Identity
The Id or node object to delete
The Id or node object to delete.
```yaml
Type: NavigationNodePipeBind
Expand All @@ -161,7 +145,7 @@ Accept wildcard characters: False
```
### -Location
{{ Fill Location Description }}
Obsolete.
```yaml
Type: NavigationType
Expand All @@ -176,7 +160,7 @@ Accept wildcard characters: False
```
### -Title
{{ Fill Title Description }}
Obsolete.
```yaml
Type: String
Expand All @@ -189,23 +173,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Expand Down
39 changes: 39 additions & 0 deletions pages/articles/building-documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Docker with Linux/Mac OS/WSL:

## Build Documentation

```bash
docker run --rm -it -v $(pwd):/home mono:6.12.0.182 sh -c "apt update && apt upgrade -y && apt install wget unzip -y; \
wget https://github.com/dotnet/docfx/releases/download/v2.51/docfx.zip; \
unzip docfx.zip -d /usr/local/lib/docfx; \
chmod +x /usr/local/lib/docfx/docfx.exe; \
/usr/bin/mono /usr/local/lib/docfx/docfx.exe build /home/pages/docfx.json;"
```

## Clean documentation

```bash
rm -rf ./pages/_site
```

# Docker with Windows CMD

## Build Documentation

```bat
docker run --rm -it -v %cd%:C:\workplace mcr.microsoft.com/windows/servercore:10.0.17763.2366-amd64 powershell -c $ProgressPreference = 'SilentlyContinue'; ^
Invoke-WebRequest https://github.com/dotnet/docfx/releases/download/v2.51/docfx.zip -OutFile $env:TEMP\docfx.zip; ^
Expand-Archive $env:TEMP\docfx.zip $env:TEMP\docfx; ^
Start-Process -NoNewWindow -FilePath $env:TEMP\docfx\docfx.exe -ArgumentList build, C:\workplace\pages\docfx.json -Wait
```

# Docker with Windows PowerShell

## Build Documentation

```powershell
docker run --rm -it -v ${pwd}:C:\workplace mcr.microsoft.com/windows/servercore:10.0.17763.2366-amd64 powershell -c "`$ProgressPreference = 'SilentlyContinue'; `
Invoke-WebRequest https://github.com/dotnet/docfx/releases/download/v2.51/docfx.zip -OutFile `$env:TEMP\docfx.zip; `
Expand-Archive `$env:TEMP\docfx.zip `$env:TEMP\docfx; `
Start-Process -NoNewWindow -FilePath `$env:TEMP\docfx\docfx.exe -ArgumentList build, C:\workplace\pages\docfx.json -Wait"
```
191 changes: 191 additions & 0 deletions pages/articles/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Using PnP PowerShell in Docker containers

Using Docker allows you to use any software inside virtual envirionments, without having to install this software directly on your laptop or server. These virtual environments are containers, which might be imagined as lightweight virtual machines. Having their own virtual disks, memory and processes, containers are rationally isolated from your laptop operating system, providing you a great way of experimenting and using any version of PnP.PowerShell without installing it.

![Using software in virtual environments, called containers](./../images/docker/dockercontainers.png)

The good news is that you will not even need to install PnP.PowerShell in containers by your own: PnP team is already publishing Docker container images for each supported and nightly release, [here](https://hub.docker.com/r/m365pnp/powershell). You will however need to install docker runtime.

If you use Windows, we would recommend you using Linux containers with help of WSL. Alternatively, even though it is not the most common way, you might want to run PnP.PowerShell in Windows containers. Mind you that some use cases might be limited when using Windows containers. If you use Mac OS or Linux, the easiest way is to use Linux containers.

## Play with PnP.PowerShell online

You can try using m365pnp/powershell Docker containers online, without installing anything on your desktop/laptop.

1. Open https://labs.play-with-docker.com/

2. Login

3. Click `Start`

4. Click `+ ADD NEW INSTANCE`

5. Run in the online console:

```
docker run --rm -it m365pnp/powershell
```
After that you can start running commands like `Connect-PnPOnline`.
## Installing Docker locally
- Mac OS:
1. Install
```bash
brew install --cask docker
```
2. Launch Docker:
- Press ⌘ + Space to bring up Spotlight Search and enter Docker to launch Docker.
- In the Docker needs privileged access dialog box, click OK.
- Enter password and click OK.
- Linux:
```bash
bash <(curl -s https://get.docker.com/)
sudo usermod -aG docker $USER
newgrp docker
```
- Linux containers on Windows (using WSL):
1. Start installing WSL:
```powershell
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux", "VirtualMachinePlatform" -NoRestart
Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile wsl_update_x64.msi -UseBasicParsing
Start-Process msiexec.exe -Wait -ArgumentList "/I $((Get-Location).Path)\wsl_update_x64.msi /quiet"
```
2. Reboot the machine before you continue
3. Finish installing WSL:
```powershell
wsl --set-default-version 2
wsl --install --distribution Ubuntu
```
4. Install docker in WSL:
```bash
bash <(curl -s https://get.docker.com/)
sudo usermod -aG docker $USER
newgrp docker
```
- Windows:
```powershell
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y docker-engine
```
## Using PnP.PowerShell
Sometimes you want to run inline PnP.PowerShell commands.
- Linux/WSL/Mac OS:
```bash
docker run --rm -it m365pnp/powershell
```
- Windows (run in PowerShell console):
```powershell
docker run --rm -it m365pnp/powershell:1.10.0-nanoserver-1809
```
After that you can start running commands like `Connect-PnPOnline`.
Mind you that in the case above, the container will have an isolated disk system so the commands that you run inside the container will not be able to access files from your host machine. However, sometimes you might want to run a script or use some files from your host OS (for example, when you have a ps1 file in a git repository that you cloned to your laptop). In this case you will need to mount a directory on your host as a volume inside the container. See the following examples.
- Linux/WSL/Mac OS:
```bash
docker run --rm -it -v "$(pwd):/home" -w /home m365pnp/powershell
```
- Windows (run in PowerShell console):
```powershell
docker run --rm -it -v "${pwd}:C:\workplace" -w C:\workplace m365pnp/powershell:1.10.0-nanoserver-1809
```
In such container you can run `Get-ChildItem` and see the contents of the current directory.
The examples above start new container and allow you to interactively use container, running inline commands. In other cases however, you might want to just start a container for a short time (a few seconds maybe) and run a ps1 script unattededly and then automatically terminate the container. Here is how you can do it.
- Linux/WSL/Mac OS:
```bash
docker run --rm -v "$(pwd):/home" -w /home m365pnp/powershell pwsh test.ps1
```
- Windows (run in PowerShell console):
```powershell
docker run --rm -v "${pwd}:C:\workplace" -w C:\workplace m365pnp/powershell:1.10.0-nanoserver-1809 pwsh test.ps1
```
Finally, your scripts might have parametrization so that you can run the same code in different cases/environments. This is the way to provide variable values.
- Linux/WSL/Mac OS:
```bash
ParameterValue="test"
docker run --rm -v "$(pwd):/home" -w /home m365pnp/powershell pwsh -c "./test.ps1 -Parameter1 $ParameterValue"
```
- Windows (run in PowerShell console):
```powershell
$ParameterValue="test"
docker run --rm -v "${pwd}:C:\workplace" -w C:\workplace m365pnp/powershell:1.10.0-nanoserver-1809 pwsh -c "./test.ps1 -Parameter1 $ParameterValue"
```
Please see [Docker documentation](https://docs.docker.com/engine/reference/run/) to see arguments for `docker run` command.
## Featured tags
### Latest
* latest: The latest stable image
* alpine-3.14
* `docker pull m365pnp/powershell` or `docker pull m365pnp/powershell:latest`
### Nightly
* nightly: The latest night image
* alpine-3.14
* `docker pull m365pnp/powershell:nightly`
## Tag explanation
Tags names mean the following:
`<version>(-nightly)-<platform>`
Currently supported platforms:
* nanoserver-ltsc2022
* nanoserver-1809
* alpine-3.14
Tag name examples:
* 1.8.0-nanoserver-ltsc2022
* 1.9.0-nanoserver-ltsc2022
* 1.10.0-nanoserver-1809
* 1.10.0-alpine-3.14
* 1.10.26-nightly-nanoserver-ltsc2022
To find the version numbers please visit https://www.powershellgallery.com/packages/PnP.PowerShell
Loading

0 comments on commit 092bd86

Please sign in to comment.