{"id":601,"date":"2020-11-28T22:28:49","date_gmt":"2020-11-28T22:28:49","guid":{"rendered":"http:\/\/www.decoutere.eu\/?p=601"},"modified":"2020-11-28T22:28:50","modified_gmt":"2020-11-28T22:28:50","slug":"onedrive-groottes-in-office365-bepalen","status":"publish","type":"post","link":"https:\/\/www.decoutere.eu\/index.php\/2020\/11\/28\/onedrive-groottes-in-office365-bepalen\/","title":{"rendered":"onedrive groottes in Office365 bepalen"},"content":{"rendered":"<div id=\"pl-601\"  class=\"panel-layout\" ><div id=\"pg-601-0\"  class=\"panel-grid panel-no-style\" ><div id=\"pgc-601-0-0\"  class=\"panel-grid-cell\" ><div id=\"panel-601-0-0-0\" class=\"so-panel widget widget_sow-editor panel-first-child panel-last-child\" data-index=\"0\" ><div\n\t\t\t\n\t\t\tclass=\"so-widget-sow-editor so-widget-sow-editor-base\"\n\t\t\t\n\t\t>\n<div class=\"siteorigin-widget-tinymce textwidget\">\n\t<p>Param(<br \/>\n\t[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]<br \/>\n    [string] $Tenantname,<br \/>\n        [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]<br \/>\n    [string] $Username,<br \/>\n\t[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]<br \/>\n    [string] $Password,<br \/>\n\t[Parameter(Position=2, Mandatory=$false, ValueFromPipeline=$true)]<br \/>\n    [string] $OutputFile<br \/>\n)<br \/>\nif ($OutputFile -eq \"\")<br \/>\n{<br \/>\n  $OutputFile=\"C:\\OneDrive_groottes.csv\"<br \/>\n}<br \/>\n$Result=@()<br \/>\n$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName(\"Microsoft.SharePoint.Client\")<br \/>\n$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName(\"Microsoft.SharePoint.Client.Runtime\")<br \/>\n$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName(\"Microsoft.SharePoint.Client.UserProfiles\")<br \/>\n$AdminURI = \"https:\/\/\" + $Tenantname +\"-admin.sharepoint.com\"<br \/>\n$OneDrivePrefixUrl=\"https:\/\/\" + $Tenantname +\"-my.sharepoint.com\"<br \/>\n$SecPwd = $Password | ConvertTo-SecureString -AsPlainText -Force<br \/>\n$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $SecPwd)<br \/>\n$UserCredential = New-Object System.Management.Automation.PSCredential -argumentlist $Username, $SecPwd<br \/>\n$proxyaddr = \"$AdminURI\/_vti_bin\/UserProfileService.asmx?wsdl\"<br \/>\n$UserProfileService= New-WebServiceProxy -Uri $proxyaddr -UseDefaultCredential False<br \/>\n$UserProfileService.Credentials = $creds<br \/>\nWrite-Progress -activity \"Fetching User Profiles\" -status \"...........\"<br \/>\n$strAuthCookie = $creds.GetAuthenticationCookie($AdminURI)<br \/>\n$uri = New-Object System.Uri($AdminURI)<br \/>\n$container = New-Object System.Net.CookieContainer<br \/>\n$container.SetCookies($uri, $strAuthCookie)<br \/>\n$UserProfileService.CookieContainer = $container<br \/>\n$UserProfileResult = $UserProfileService.GetUserProfileByIndex(-1)<br \/>\nWrite-Host \"Starting- This could take a while.\"<br \/>\n$NumProfiles = $UserProfileService.GetUserProfileCount()<br \/>\n$i = 1<br \/>\nConnect-SPOService -Url $AdminURI -Credential $UserCredential<br \/>\nWhile ($UserProfileResult.NextValue -ne -1)<br \/>\n{<br \/>\nWrite-Progress -activity \"Processing User Profiles\" -status \"$i out of $NumProfiles completed\"<br \/>\n$Prop = $UserProfileResult.UserProfile | Where-Object { $_.Name -eq \"PersonalSpace\" }<br \/>\n$Url= $Prop.Values[0].Value<br \/>\nif ($Url) {<br \/>\n$siteurl = $OneDrivePrefixUrl + $Url.Substring(0,$Url.Length-1)<br \/>\n$temp = Get-SPOSite $siteurl -Detailed<br \/>\nif($temp)<br \/>\n{<br \/>\n$Result += New-Object PSObject -property @{<br \/>\nUserName = $temp.Title<br \/>\nUserPrincipalName = $temp.Owner<br \/>\nTotalSize_MB = $temp.StorageUsageCurrent<br \/>\nTotalSize_GB = $temp.StorageUsageCurrent\/1024<br \/>\nStorageQuota_GB = $temp.StorageQuota\/1024<br \/>\nWarningSize_GB =\u00a0 $temp.StorageQuotaWarningLevel\/1024<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n$UserProfileResult = $UserProfileService.GetUserProfileByIndex($UserProfileResult.NextValue)<br \/>\n$i++<br \/>\n}<br \/>\n$Result | Select-object -property UserName,UserPrincipalName,TotalSize_MB,TotalSize_GB,StorageQuota_GB,WarningSize_GB |Export-CSV $OutputFile -NoTypeInformation -Encoding UTF8<br \/>\nWrite-Host \"OneDrive for Business Storage Report successfully exported to \"$OutputFile -foregroundcolor Green<\/p>\n<\/div>\n<\/div><\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [string] $Tenantname, [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [string] $Username, [Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)] [string] $Password, [Parameter(Position=2, Mandatory=$false, ValueFromPipeline=$true)] [string] $OutputFile ) if ($OutputFile -eq &#8220;&#8221;) { $OutputFile=&#8221;C:\\OneDrive_groottes.csv&#8221; } $Result=@() $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName(&#8220;Microsoft.SharePoint.Client&#8221;) $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName(&#8220;Microsoft.SharePoint.Client.Runtime&#8221;) $loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName(&#8220;Microsoft.SharePoint.Client.UserProfiles&#8221;) $AdminURI = &#8220;https:\/\/&#8221; + $Tenantname +&#8221;-admin.sharepoint.com&#8221; $OneDrivePrefixUrl=&#8221;https:\/\/&#8221; + $Tenantname +&#8221;-my.sharepoint.com&#8221; $SecPwd = $Password | ConvertTo-SecureString -AsPlainText [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-601","post","type-post","status-publish","format-standard","hentry","category-geen-categorie"],"_links":{"self":[{"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/posts\/601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/comments?post=601"}],"version-history":[{"count":1,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/posts\/601\/revisions"}],"predecessor-version":[{"id":602,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/posts\/601\/revisions\/602"}],"wp:attachment":[{"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/media?parent=601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/categories?post=601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.decoutere.eu\/index.php\/wp-json\/wp\/v2\/tags?post=601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}