Some of you may have noticed my recent posts on some questions in the forum. Here’s another one… 🙂
I’m trying to create some deployment scripts using PowerShell. I’m able to connect to my tenant but am not able to do much with it afterwards. Any thoughts?
Add-Type -Path “C:\dll\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\dll\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\dll\Microsoft.SharePoint.Client.Taxonomy.dll”
$tenantAdmin = “https://tenant-admin.sharepoint.com”
$tenantRoot = “https://tenant.sharepoint.com”
$adminUser = “haniel@tenant.onmicrosoft.com”
$password = “password”
 
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($adminUser, $securePassword)
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($tenantRoot)
$ctx.Credentials = $credentials
$webs = $ctx.Web
$ctx.Web or other objects I’m trying to access come back as null. Any thoughts?
Feel free to email me any screen shots that you can take of the issues as ive tested it on PS v2 and above – I’m currently running Win10 and it works fine for me
ryan.yates@kilsauit.org