Forum Discussion
Creating modern site with PnP powershell
I'm getting the following error with the latest PnP Online module. Does this work for anyone?
New-PnPSite -Type TeamSite -Title Portfolio -Alias pc
New-PnPSite : Object reference not set to an instance of an object.
At line:1 char:1
+ New-PnPSite -Type TeamSite -Title Portfolio -Alias pc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [New-PnPSite], NullReferenceException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewSite
I initially was thinking it was due to the way you login, as we fixed an issue with using the -WebLogin parameters. But indeed, in your case it is the mailnickname that is causing the issue, it is not related to your login. Indeed, the Alias parameter value cannot contain a space.
I'll add a check in the backend code for that.
8 Replies
- Did you run connect-pnponline first?
- Dean_GrossSilver Contributoryes
- Not at a PC but command looks right. Try and enable debug level tracing.
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/SetPnPTraceLog.md