Wednesday, March 6, 2019

MS-301

MS-301T01

Lab

Module 1

SharePoint 2019 Updates

https://docs.microsoft.com/en-us/OfficeUpdates/sharepoint-updates

Module 3

New-SPContentDatabase -Name WSS_Content_Teams –WebApplication http://teams.adatum.com

New-SPSite -Url http://teams.adatum.com/sites/ModernTeamSite
-ContentDatabase WSS_Content_Teams -Name "Modern Team Site" -OwnerAlias
adatum\Administrator -Template "STS#3"

MS-301T03

Lab

Module 3

App Management

Add-PSSnapin *sharepoint*

$appPool = Get-SPServiceApplicationPool -Identity "SharePoint Web Services System"

$amsa = New-SPAppManagementServiceApplication -Name “App Management Service” -DatabaseName “Farm_App_Management” –ApplicationPool $appPool

$amsaProxy = New-SPAppManagementServiceApplicationProxy -Name " App Management Service Proxy" -UseDefaultProxyGroup -ServiceApplication $amsa

Get-SPServiceInstance | Where-Object {$_.TypeName -like "*App Management Service*"} | Start-SPServiceInstance

Tuesday, March 5, 2019

MS-300

MS-300T01

Module 1

1. Sign in to VM as administrative account

2. Install SharePoint Online Management Shell module
a. Open Windows PowerShell and run as administrator

b. Run following command to install SharePoint Online Management Shell
module, and Yes and All to prompt questions

   Install-Module -Name Microsoft.Online.SharePoint.PowerShell

3. Connect to SharePoint Online Service
a. Run the following command in the same PowerShell window as previous step. Please replace the TenanatName to the one you got from exercise 1. Enter the password while got prompt for credential. 

$adminUPN="admin@<TenantName>.onmicrosoft.com" $orgName="<TenantName>" $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password." Connect-SPOService `
    -Url https://$orgName-admin.sharepoint.com -Credential $userCredential 
 
4. Register the site as a hub site
a. Run the following command in the same PowerShell window as previous step

Register-SPOHubSite "https://<TenantName>.sharepoint.com/sites/HRWeb" `
   -Principals admin@<TenantName>.onmicrosoft.com

MS-300T02

Module 2

Term Set Info

Term Set Name,Term Set Description,LCID,Available for Tagging,Term Description,Level 1 Term,Level 2 Term,Level 3 Term,Level 4 Term,Level 5 Term,Level 6 Term,Level 7 Term
Department,"A sample term set, describing a simple department.",,TRUE,Departments,Departments,,,,,,
,,,TRUE,HR department,Departments,HR,,,,,
,,,TRUE,Marketing department,Departments,Marketing,,,,,
,,,TRUE,Engineer department,Departments,Engineer,,,,,

MS-300T02

Module 4

https://sample-videos.com/

Friday, January 25, 2019

Windows–DISM PowerShell Replacement

So you need to find the version of windows on your ISO file but you named it windows.iso … well here is how we solved that using DISM
dism /Get-WimInfo /WimFile:F:\sources\install.esd /index:1
Now using PowerShell
Get-WindowsImage –imagepath .\install.wim
but what if you don’t have the install.wim … look for install.esd instead
Get-WindowsImage –impagepath .\install.esd






















References
https://www.computerworld.com/article/3309257/microsoft-windows/grab-a-free-copy-of-win10-version-1803-and-save-it-for-a-rainy-day.html
https://www.winhelponline.com/blog/iso-find-windows-build-version-edition-using-dism/
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/use-dism-in-windows-powershell-s14

Tuesday, January 8, 2019

Fun PowerShell

Roll fair dice

Input the number of pips on the die
Input the number of rolls

reference doc.microsoft.com
PS /> 1..1200 | ForEach-Object { 1..6 | Get-Random } | Group-Object | Select-Object Name,Count
Name Count
---- -----
1      206
2      199
3      196
4      226
5      185
6      188
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-random?view=powershell-6

Tuesday, December 18, 2018

PowerShell 101 - Basics


How to get Help

https://docs.microsoft.com/en-us/powershell

Help
Get-Help
Help vs Get-Command
search command using Bing or google

Search using https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/?view=powershell-6

How to Edit

Tab Complete
History

What is Piping?

Select
More

example: Get-Process | More
example: Get-Process | Select * | More

example: Get-Command | Measure-Object

Variables?

variables
collections
array
Get-Member

example: $temp = Get-Process
example: $temp | Get-Member
example: $temp = Get-Process[0]


Note if help files are missing run update-help or go here to help online


How to get Help

Help
Get-Help
Help vs Get-Command
search

How to Edit

Tab Complete
History

What is Piping?

Select
More
Measure

Variables?

collections
array
get member

Editor

Command line vs ISE

Keyboard Shortcuts

https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/ise/keyboard-shortcuts-for-the-windows-powershell-ise
https://technet.microsoft.com/en-us/library/ff678293.aspx

Tuesday, December 4, 2018

SharePoint PowerShell 2013 Reference Guide

SharePoint PowerShell from 20331 and 20332

Managed Metadata

New-ADUser -SamAccountName SPSalesMMS -Name "SharePoint Sales MMS" -UserPrincipalName "SPSalesMMS@contoso.com" -AccountPassword (Read-host “enter password” -AsSecureString) -Path “OU=SharePoint,DC=Contoso,DC=com” -Enabled $true -PasswordNeverExpires $true -ChangePasswordAtLogon $false

New-SPManagedAccount

$AppPool = New-SPServiceApplicationPool -Name ContosoSalesMMSAppPool -Account SPSalesMMS@contoso.com

$MMS = New-SPMetadataServiceApplication -Name "Contoso Sales Managed Metadata" -ApplicationPool $AppPool -DatabaseName ContosoSalesMMS -HubUri http://sales.contoso.com

New-SPMetadataServiceApplicationProxy -Name "Contoso Sales Managed Metadata" -ServiceApplication $MMS –DefaultProxyGroup

State Service

$serviceApp = New-SPStateServiceApplication -Name "StateService-App"

New-SPStateServiceDatabase -Name "SS-Database" -ServiceApplication $serviceApp

New-SPStateServiceApplicationProxy -Name "StateService-App" -ServiceApplication $serviceApp -DefaultProxyGroup

Friday, November 30, 2018

Azure and Office 365 PowerShell


Office 365

Recycle Bin - 2019.3
https://lazyadmin.nl/powershell/restore-recycle-bin-sharepoint-online-with-powershell/

Flow - How to Disable the Flow button in SharePoint Online - 2019.3
https://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=786

Useful PowerShell cmdlets to administer Office 365 Groups - 2019.3
https://vigneshsharepointthoughts.com/2018/05/16/useful-powershell-cmdlets-to-administer-office-365-groups/

Teams – 2019.3
http://sharepoint-tricks.com/manage-your-teams-on-microsoft-teams

SharePoint – Site Design - 2019.3
https://drewmadelung.com/powershell-for-sharepoint-site-designs-site-scripts

55238 PowerShell Lab A

New-MsolUser –UserPrincipalName pete@CKXXXX.onmicrosoft.com –DisplayName “Pete Coventry” –FirstName “Pete” –LastName “Coventry” –Password ‘NH-1Train’ -ForceChangePassword $false –UsageLocation “GB”

New-MsolUser –UserPrincipalName ashley@CKXXXX.onmicrosoft.com –DisplayName “Ashley Curtis” –FirstName “Ashley” –LastName “Curtis” –Password ‘NH-1Train’ -ForceChangePassword $false –UsageLocation “GB”

New-MsolUser –UserPrincipalName mark@CKXXXX.onmicrosoft.com –DisplayName “Mark Summers” –FirstName “Mark” –LastName “Summers” –Password ‘NH-1Train’ -ForceChangePassword $false –UsageLocation “GB”

New-MsolUser –UserPrincipalName shannen@CKXXXX.onmicrosoft.com –DisplayName “Shannen Smith” –FirstName “Shannen” –LastName “Smith” –Password ‘NH-1Train’ -ForceChangePassword $false –UsageLocation “GB”

New-MsolUser –UserPrincipalName sarah@CKXXXX.onmicrosoft.com –DisplayName “Sarah Manley” –FirstName “Sarah” –LastName “Manley” –Password ‘NH-1Train’ -ForceChangePassword $false –UsageLocation “GB”

Get-Msoluser

Get-Msoluser –unlicensedusersonly

Set-MsolUserLicense -UserPrincipalName pete@CKXXXX.onmicrosoft.com –AddLicenses“CKXXXX:ENTERPRISEPREMIUM”

Set-MsolUserLicense -UserPrincipalName ashely@CKXXXX.onmicrosoft.com –AddLicenses“CKXXXX:ENTERPRISEPREMIUM”

Set-MsolUserLicense -UserPrincipalName mark@CKXXXX.onmicrosoft.com –AddLicenses“CKXXXX:ENTERPRISEPREMIUM”

Set-MsolUserLicense –UserPrincipalName sarah@CKXXXX.onmicrosoft.com –AddLicenses“CKXXXX:ENTERPRISEPREMIUM”

Set-MsolUserLicense –UserPrincipalName shannen@CKXXXX.onmicrosoft.com –AddLicenses“CKXXXX:ENTERPRISEPREMIUM”

Get-Msoluser

Additional Learning

$unlicensed = Get-Msoluser –unlicensedusersonly
$license = “CKXXXX:ENTERPRISEPREMIUM”

Set-MsolUserLicense –UserPrincipalName $unlisensed[0].userprinciplename–AddLicenses $license

55238 PowerShell Lab B

Connect-SPOService –Url https://CKXXXXX-admin.sharepoint.com –credentialzoe@CKXXXX.onmicrosoft.com

New-SPOSite -Url https://CKXXXX.sharepoint.com/sites/hr -title "HR Home" –Owner zoe@CKXXXX.onmicrosoft.com -storagequota 1024 -Template STS#0

Get-SPOSite

https://drm.combined-knowledge.com/cklabs/spoadmin/labs.zip

Import-Csv .\NewSPOSites.csv| % {New-SPOSite -Owner $_.Owner –StorageQuota $_.StorageQuota -Url $_.Url -NoWait -ResourceQuota $_.ResourceQuota –Template $_.Template -Title $_.Name}

Get-SPOSite

Set-SPOUser -site https://CKXXXX.sharepoint.com/sites/hr –LoginName pete@CKXXXX.onmicrosoft.com -IsSiteCollectionAdmin $True

Get-SPOUser -Site https://CKXXXX.sharepoint.com/sites/hr | where {$_.IsSiteAdmin}

$spoSites=Get-SPOSite | Select *

foreach($spoSite in $spoSites)

{

Write-Host "Admins for " $spoSite.Url -foregroundcolor Yellow

Get-SPOUser -Site $spoSite.Url | where {$_.IsSiteAdmin}

Write-Host

}

Set-SPOSite -identity https://CKXXXX.sharepoint.com/sites/intranet –StorageQuota 15000 -StorageQuotaWarningLevel 13000

$spoSites=Get-SPOSite | Select *

foreach($spoSite in $spoSites)

{

Write-Host "Changing Quota for " $spoSite.Url -foregroundcolor Yellow

Set-SPOSite -identity $spoSite.URL -StorageQuota 12500 -StorageQuotaWarningLevel 11000

Write-Host

}

Remove-SPOSite https://CKXXXX.sharepoint.com/sites/ProjectSite

Remove-SPODeletedSite https://CKXXXX.sharepoint.com/sites/ProjectSite


Legacy – Azure O365

SharePoint Online Management Shell
http://www.microsoft.com/en-us/download/details.aspx?id=35588
Office 365 cmdlets will make working with SharePoint Online very similar to working with SharePoint on-premises.
Creating List and Libraries using CSOM
http://sharepoint-community.net/profiles/blogs/powershell-import-list-items-from-csv-client-object-model

Scripting Guys – Always Great Start to Your Day
 http://blogs.technet.com/b/heyscriptingguy/archive/2014/03/28/manage-office-365-sharepoint-with-modules.aspx
Gary Lapointe – PowerShell Author
http://blog.falchionconsulting.com/index.php/2014/01/announcing-my-custom-sharepoint-online-cmdlets
Create Folder in Office 365
http://www.enjoysharepoint.com/Articles/Details/create-folders-csom-powershell-script-office-365-sharepoint-online-21042.aspx

Windows Azure Active Directory Module for Windows PowerShell

First you need the modules …
Using Server 2012 no issues, install Microsoft Online Services Sign-in Assistant and AD Module, no issues.
http://technet.microsoft.com/en-us/library/jj151815.aspx
I followed this with no luck on Windows 7 on 32 bit, appears there is a bug and the fix is to run the beta software for the Microsoft Online Services Sign-in Assistant. (shaking my head)
http://social.msdn.microsoft.com/Forums/windowsazure/en-US/46a38822-28a4-4abb-b747-96f7db2a2676/cannot-install-azure-active-directory-module-for-windows-powershell-mossia-is-not-installed

Now that is is loaded it is fairly simple to test.  Start my opening the new Icon on your desktop.
You need to set your credentials and pass that to Microsoft Office 365.  Making sure to logon using admin@yourdemodomain.onmicrosoft.com

$msolcred = get-credential
connect-msolservice -credential $msolcred

Now test my simply running a command to get your users.
Get-MsolUser
 
More tests - Admin Roles
Get-MsolRole | select name,description | ft –autosize
 
More Tests – Domain Info
Get-MsolDomain
 
More Tests – Subscription Info
Get-MsolSubscription
Get-MsolAccountSku

SharePoint Online Management Shell


So for SharePoint Online Management Shell the step are very similar to Office 365. First set your variable for both your admin credentials and website.  Next run the connect command both Office 365 and SharePoint Online. Once you successfully run both command you get no errors just a returned prompt.  So here are the commands noting that the domain is contoso.sharepoint.com
Logon to Office 365 with you admin account and go to the admin screen for SharePoint, this account later used for $mycred variable.
 
Look at the admin address since this will give you the right URL to manage and will use for $mysite variable.
Run the following commands in the new SharePoint Online Management Shell
 
$mycred = get-credential
$mysite = ‘https://contoso-admin.sharepoint.com”
connect-msolservice -credential $mycred
connect-SPOService -Url $mysite -credential $mycred

test using the following commands:
get-msoluser
get-sposite

Help


http://powershell.office.com/

Subscription


http://dev.office.com/