Dear people,
I hope that some one can give me some information
i have a script for pnp powershel to check if a teamsite exists, if not then create it, if it exists first delete and then recreate.
Now i have a another script that is for provisioning tempate for a teamsite.
now i whant to run that script after my script for site creation is finished i have the following
<hr />
#create the admin credentials for connecting to sharepoint online services $Username = "username" $Password = ConvertTo-SecureString "this will be a password" -AsPlainText -force $cred = New-Object -TypeName System.management.automation.pscredential -ArgumentList $Username, $Password $org = "organization" $siteurl = "https://$org.sharepoint.com/sites/Project001" Connect-PnPOnline -Url "https://$org-admin.sharepoint.com/" -credential $cred $Project001 = Get-PnPTenantSite -Identity $siteurl -ErrorAction SilentlyContinue <#With the if else statement the script will verify if the sitecollection already exisits If the site doesnt exists it will be created based on the new-pnptenantsite criteria. If the site already exists it will delete and skip the recycle bin time before recreate the site #> if ([string]::IsNullOrEmpty($Project001)) { Write-Output "a new project site will be created" New-PnPTenantSite ` -Title "Project001" ` -Url $siteurl ` -Description "test" ` -Owner $username ` -TimeZone 4 ` -Template "STS#3" ` -Wait Write-output "Site is created" } else { Write-Output "the project site already exist and will now be deleted" Remove-PnPTenantSite -url "url" -Force -SkipRecycleBin Write-Output "Old site is now deleted" Write-Output "The project site will now be re-created" New-PnPTenantSite ` -Title "Project001" ` -Url $siteurl ` -Description "provisioning testing for communities" ` -Owner $Username ` -TimeZone 4 ` -Template "STS#3" ` -Wait Write-output "Site is created" } $scriptfilelocation = "C:\temp\testscript.ps1" Write-Output "The template provisioning for projects will nou start" Invoke-Expression -Command $scriptfilelocation <#what must be done here#> Write-Output "The template provisioning is succesful runned"