Giter Club home page Giter Club logo

connect-o365's People

Contributors

domesticus avatar josverl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

connect-o365's Issues

Add Userprofile connection

Suggest to add Userprofile directly withouth a dependency on OfficePNP ?

https://support.office.com/en-us/article/Assign-eDiscovery-permissions-to-OneDrive-for-Business-sites-422858ff-917b-46d4-9e5b-3397f60eee4d?ui=en-US&rs=en-US&ad=US

Save the following text to a text file. For example, you could save it to a file named GetOD4BSites.txt.

URL for your organization's SharePoint Online admin service

$AdminURI = "https://-admin.sharepoint.com"

User account for an Office 365 global admin in your organization

$AdminAccount = ""
$AdminPass = ""

Where should we save the list of MySites?

$LogFile = 'C:\Users\youralias\Desktop\ListOfMysites.txt'

Begin the process

$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")

Convert the Password to a secure string, then zero out the cleartext version ;)

$sstr = ConvertTo-SecureString -string $AdminPass -AsPlainText –Force
$AdminPass = ""

Take the AdminAccount and the AdminAccount password, and create a credential

$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminAccount, $sstr)

Add the path of the User Profile Service to the SharePoint Online admin URL, then create a new webservice proxy to access it

$proxyaddr = "$AdminURI/_vti_bin/UserProfileService.asmx?wsdl"
$UserProfileService= New-WebServiceProxy -Uri $proxyaddr -UseDefaultCredential False
$UserProfileService.Credentials = $creds

Take care of auth cookies

$strAuthCookie = $creds.GetAuthenticationCookie($AdminURI)
$uri = New-Object System.Uri($AdminURI)
$container = New-Object System.Net.CookieContainer
$container.SetCookies($uri, $strAuthCookie)
$UserProfileService.CookieContainer = $container

Grab the first User profile, at index -1

$UserProfileResult = $UserProfileService.GetUserProfileByIndex(-1)

Write-Host "Starting- This could take a while."

$NumProfiles = $UserProfileService.GetUserProfileCount()
$i = 1

As long as the next User profile is NOT the one we started with (at -1)...

While ($UserProfileResult.NextValue -ne -1)
{
Write-Host "Examining profile $i of $NumProfiles"

Look for the Personal Space object in the User Profile and pull it out

(PersonalSpace is the name of the path to a user's mysite)

$Prop = $UserProfileResult.UserProfile | Where-Object { $_.Name -eq "PersonalSpace" }
$Url= $Prop.Values[0].Value

If "PersonalSpace" (which we've copied to $Url) exists, log it to our file...

if ($Url) {
$Url | Out-File $LogFile -Append -Force
}

And now we check the next profile the same way...

$UserProfileResult = $UserProfileService.GetUserProfileByIndex($UserProfileResult.NextValue)
$i++
}

Write-Host "Done!"

Add a default account and services

For those of us who generally only connect to one Office365 instance, it'd be great to not have to specify the account all the time. Similarly, it makes scripts more portable if I'm not specifying the account all the time.

Similarly, if I mostly connect to exchange, I'd like to be able to connect to it without specifying -EXO

Get-O365ModuleFile is not recognized as the name of a cmdlet

I am getting the below error when running Connect-O365.ps1 -Install. The ConnectO365 module has already been installed as per the Powershell gallery instructions.

Get-O365ModuleFile : The term 'Get-O365ModuleFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Scripts\Connect-O365.ps1:609 char:9

  •     Get-O365ModuleFile
    
  •     ~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Get-O365ModuleFile:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Convert to a module

Is there any reason why this is a script rather than a module?

It does seem a bit strange when tab-completing to have the .ps1 on the end of the command.

It also means I can depend on this module in my own modules down the line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.