First from CMD, that is pretty easy:

Now, with PowerShell, it is about the same, we call the user32.dll, just it is a little more work to get that to work right:

Credit for how to call DLLs from PowerShell goes to Danny.

Ever wished you could have multiple consoles and stuff open without carefully rearranging them and then the Windows dock features messes it up and yaddi yadda?

Well, I found a superb solution for that: ConEmu

conemu-maximus5

 

 

 

 

 

 

 

 

 

 

The 2 most handy commands you’ll need:

^ That is needed to create the Windows as you want. From there you can use them as regular console Windows. So handy!

So since I just wasted more time than I want to admit getting this figured out, I’ going to share here how to add  Group permissions. Googeling, there is not a whole lot of info about it out there and most sites even say it is not supported. There is unfortunately no ‘Get-SPOGroup’ cmdlet, so PowerShell does not help in this case. Ugg, Microsoft, I thought that was the whole point of PowerShell!? Well, you can get the needed info via GUI.

The problem:

We need to be able to access and manage the SharePoint and mainly the OneDrive for Business content for users. We can do that easily via GUI, but going to the
Sharepoint Admincenter -> User Profiles -> Type in a name -> Right-click on ‘Manage Site Collection Owners’ -> Add the ‘AD Admin Group’ 

spol

Now, that is all fine and dandy, but we have thousands of users, so if doing the above thousands of times, does not sound too fun. We also don’t have an intern handy to do this…

Now, the really frustrating part is, that you can not do that easily via PowerShell either!?!

Now the good news is, yes you can do it via PowerShell, the bad news is, to get the needed info, you can not use PowerShell, you have to do some diggin’ to get the SID form the Sharepoint Online GUI:

  1. Navigate to the root of the sharepoint site:
  2. Click on the gear/cog on the top right and click on  ‘Site settings
  3. Under ‘Users and Permissions, click on ‘Site permissions’
  4. In the top ribbon, click on ‘Check Permissions’
  5. Type in the ‘AD ADMIN GROUP’ name and click on ‘Check Now’

On the bottom you’ll see a tiny line coming up, giving you the SID of the group

 

The final PowerShell command to set the group permission for a single user is like so:

And the following script will iterate through all SPO users and assign the rights

Credit mainly goes to http://www.jijitechnologies.com for the iteration part.

I hope for you avid Googler who has to do the same, this will save you some time.

 

 

One thing that has annoyed me for a long time, si the fact that there was no obvious / easy way to connect to the console session of a VM, so you have to open the Hyper-V manager, click on your VM and click on ‘connect’. That’s just too much clicking…

I found that Hyper-V manager is using the ‘vmconnect.exe’ to connect to the console session, and I wrote this little function that will kind of act like ‘enter-pssession’ just instead of connection to a session it actually launches the vm console. Saved me alot of time. :o)