Friday, July 26, 2019

Best PowerShell Functions & Scripts Ever!

So you want to jazz up your scripts … check out these great additions

Basic Beep

#beep

[console]::beep(440,500)

#scale

$scale=@{
MidC=261.6
CSharp=277.2
D=293.7
DSharp=311.1
E=329.6
F=349.2
FSharp=370.0
G=392.0
GSharp=415.3
A=440.0
ASharp=466.2
B=493.9
C=523.2
}

#play a chromatic scale
write-host “First octave” -ForegroundColor Cyan
$scale.values | sort | foreach {[console]::beep($_,125)}

Basic Music

# Star Wars

Function Play-StarWars {
      [console]::beep(440,500)
      [console]::beep(440,500)
      [console]::beep(440,500)
      [console]::beep(349,350)
      [console]::beep(523,150)
      [console]::beep(440,500)
      [console]::beep(349,350)
      [console]::beep(523,150)
      [console]::beep(440,1000)
      [console]::beep(659,500)
      [console]::beep(659,500)
      [console]::beep(659,500)
      [console]::beep(698,350)
      [console]::beep(523,150)
      [console]::beep(415,500)
      [console]::beep(349,350)
      [console]::beep(523,150)
      [console]::beep(440,1000)
}

Play-StarWars

#imperial march

Function Play-ImperialMarch{

[console]::beep(440,500)
[console]::beep(440,500)
[console]::beep(440,500)
[console]::beep(349,350)
[console]::beep(523,150)

[console]::beep(440,500)
[console]::beep(349,350)
[console]::beep(523,150)
[console]::beep(440,1000)

[console]::beep(659,500)
[console]::beep(659,500)
[console]::beep(659,500)
[console]::beep(698,350)
[console]::beep(523,150)

[console]::beep(415,500)
[console]::beep(349,350)
[console]::beep(523,150)
[console]::beep(440,1000)

[console]::beep(880,500)
[console]::beep(440,350)
[console]::beep(440,150)
[console]::beep(880,500)
[console]::beep(830,250)
[console]::beep(784,250)

[console]::beep(740,125)
[console]::beep(698,125)
[console]::beep(740,250)

[console]::beep(455,250)
[console]::beep(622,500)
[console]::beep(587,250)
[console]::beep(554,250)

[console]::beep(523,125)
[console]::beep(466,125)
[console]::beep(523,250)

[console]::beep(349,125)
[console]::beep(415,500)
[console]::beep(349,375)
[console]::beep(440,125)

[console]::beep(523,500)
[console]::beep(440,375)
[console]::beep(523,125)
[console]::beep(659,1000)

[console]::beep(880,500)
[console]::beep(440,350)
[console]::beep(440,150)
[console]::beep(880,500)
[console]::beep(830,250)
[console]::beep(784,250)

[console]::beep(740,125)
[console]::beep(698,125)
[console]::beep(740,250)

[console]::beep(455,250)
[console]::beep(622,500)
[console]::beep(587,250)
[console]::beep(554,250)

[console]::beep(523,125)
[console]::beep(466,125)
[console]::beep(523,250)

[console]::beep(349,250)
[console]::beep(415,500)
[console]::beep(349,375)
[console]::beep(523,125)

[console]::beep(440,500)
[console]::beep(349,375)
[console]::beep(261,125)
[console]::beep(440,1000)

}

Play-ImperialMarch

# Mission Impossible

Function Play-MissionImpossible{

[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(932,150)
Start-Sleep -m 150
[console]::beep(1047,150)
Start-Sleep -m 150
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(699,150)
Start-Sleep -m 150
[console]::beep(740,150)
Start-Sleep -m 150
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(932,150)
Start-Sleep -m 150
[console]::beep(1047,150)
Start-Sleep -m 150
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(784,150)
Start-Sleep -m 300
[console]::beep(699,150)
Start-Sleep -m 150
[console]::beep(740,150)
Start-Sleep -m 150
[console]::beep(932,150)
[console]::beep(784,150)
[console]::beep(587,1200)
Start-Sleep -m 75
[console]::beep(932,150)
[console]::beep(784,150)
[console]::beep(554,1200)
Start-Sleep -m 75
[console]::beep(932,150)
[console]::beep(784,150)
[console]::beep(523,1200)
Start-Sleep -m 150
[console]::beep(466,150)
[console]::beep(523,150)

}

Play-MissionImpossible

# Mario

Function Play-Mario{

$i = 1

do {Write-Host $i; $i++

[console]::beep(659,250) ##E

[console]::beep(659,250) ##E

[console]::beep(659,300) ##E

[console]::beep(523,250) ##C

[console]::beep(659,250) ##E

[console]::beep(784,300) ##G

[console]::beep(392,300) ##g

[console]::beep(523,275) ## C

[console]::beep(392,275) ##g

[console]::beep(330,275) ##e

[console]::beep(440,250) ##a

[console]::beep(494,250) ##b

[console]::beep(466,275) ##a#

[console]::beep(440,275) ##a

[console]::beep(392,275) ##g

[console]::beep(659,250) ##E

[console]::beep(784,250) ## G

[console]::beep(880,275) ## A

[console]::beep(698,275) ## F

[console]::beep(784,225) ## G

[console]::beep(659,250) ## E

[console]::beep(523,250) ## C

[console]::beep(587,225) ## D

[console]::beep(494,225) ## B

}

until ($i -gt 1)

}

Play-Mario

Advanced Music

# Mario Long Version

function Play-Mario-Long {

function b($a,$b){
     [console]::beep($a,$b)
}
function s($a){
     sleep -m $a
}
write-host "Super Mario!"
b 660 100;
s 150;
b 660 100;
s 300;
b 660 100;
s 300;
b 510 100;
s 100;
b 660 100;
s 300;
b 770 100;
s 550;
b 380 100;
s 575;

b 510 100;
s 450;
b 380 100;
s 400;
b 320 100;
s 500;
b 440 100;
s 300;
b 480 80;
s 330;
b 450 100;
s 150;
b 430 100;
s 300;
b 380 100;
s 200;
b 660 80;
s 200;
b 760 50;
s 150;
b 860 100;
s 300;
b 700 80;
s 150;
b 760 50;
s 350;
b 660 80;
s 300;
b 520 80;
s 150;
b 580 80;
s 150;
b 480 80;
s 500;

b 510 100;
s 450;
b 380 100;
s 400;
b 320 100;
s 500;
b 440 100;
s 300;
b 480 80;
s 330;
b 450 100;
s 150;
b 430 100;
s 300;
b 380 100;
s 200;
b 660 80;
s 200;
b 760 50;
s 150;
b 860 100;
s 300;
b 700 80;
s 150;
b 760 50;
s 350;
b 660 80;
s 300;
b 520 80;
s 150;
b 580 80;
s 150;
b 480 80;
s 500;

b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 150;
s 300;
b 380 100;
s 150;
b 430 100;
s 150;

b 500 100;
s 300;
b 430 100;
s 150;
b 500 100;
s 100;
b 570 100;
s 220;

b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 200;
s 300;

b 1020 80;
s 300;
b 1020 80;
s 150;
b 1020 80;
s 300;

b 380 100;
s 300;
b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 150;
s 300;
b 380 100;
s 150;
b 430 100;
s 150;

b 500 100;
s 300;
b 430 100;
s 150;
b 500 100;
s 100;
b 570 100;
s 420;

b 585 100;
s 450;

b 550 100;
s 420;

b 500 100;
s 360;

b 380 100;
s 300;
b 500 100;
s 300;
b 500 100;
s 150;
b 500 100;
s 300;

b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 150;
s 300;
b 380 100;
s 150;
b 430 100;
s 150;

b 500 100;
s 300;
b 430 100;
s 150;
b 500 100;
s 100;
b 570 100;
s 220;

b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 200;
s 300;

b 1020 80;
s 300;
b 1020 80;
s 150;
b 1020 80;
s 300;

b 380 100;
s 300;
b 500 100;
s 300;

b 760 100;
s 100;
b 720 100;
s 150;
b 680 100;
s 150;
b 620 150;
s 300;

b 650 150;
s 300;
b 380 100;
s 150;
b 430 100;
s 150;

b 500 100;
s 300;
b 430 100;
s 150;
b 500 100;
s 100;
b 570 100;
s 420;

b 585 100;
s 450;

b 550 100;
s 420;

b 500 100;
s 360;

b 380 100;
s 300;
b 500 100;
s 300;
b 500 100;
s 150;
b 500 100;
s 300;

b 500 60;
s 150;
b 500 80;
s 300;
b 500 60;
s 350;
b 500 80;
s 150;
b 580 80;
s 350;
b 660 80;
s 150;
b 500 80;
s 300;
b 430 80;
s 150;
b 380 80;
s 600;

b 500 60;
s 150;
b 500 80;
s 300;
b 500 60;
s 350;
b 500 80;
s 150;
b 580 80;
s 150;
b 660 80;
s 550;

b 870 80;
s 325;
b 760 80;
s 600;

b 500 60;
s 150;
b 500 80;
s 300;
b 500 60;
s 350;
b 500 80;
s 150;
b 580 80;
s 350;
b 660 80;
s 150;
b 500 80;
s 300;
b 430 80;
s 150;
b 380 80;
s 600;

b 660 100;
s 150;
b 660 100;
s 300;
b 660 100;
s 300;
b 510 100;
s 100;
b 660 100;
s 300;
b 770 100;
s 550;
b 380 100;
s 575;
}

Play-Mario-Long

# Christmas Music Jingle Bells

Function Play-JingleBells{

$Notes = New-Object -TypeName psobject -Property @{
     REST    = 0
     GbelowC = 196
     A       = 220
     Asharp  = 233
     B       = 247
     C       = 262
     Csharp  = 277
     D       = 294
     Dsharp  = 311
     E       = 330
     F       = 349
     Fsharp  = 370
     G       = 392
     Gsharp  = 415
     AA      = 440
     AAsharp = 466
     BB      = 493
     CC      = 523
     CCsharp = 554
     DD      = 587
     DDsharp = 622
     EE      = 659
     FF      = 698
     FFsharp = 740
     GG      = 784
     GGsharp = 830
     }
 
$Duration = New-Object -TypeName psobject -Property @{
     WHOLE     = 1600
     HALF      = 800
     QUARTER   = 400
     EIGHTH    = 200
     SIXTEENTH = 100
     }
 
 
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.C, $Duration.HALF   )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.D, $Duration.HALF   )
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.D, $Duration.EIGHTH )
[console]::beep($Notes.E, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
 
[console]::beep($Notes.E, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.E, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.C, $Duration.HALF   )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.D, $Duration.HALF   )
Start-Sleep -m $Duration.QUARTER
[console]::beep($Notes.D, $Duration.EIGHTH )
 
 
[console]::beep($Notes.E, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.EIGHTH)
[console]::beep($Notes.DD, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.HALF)
[console]::beep($Notes.CC, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
 
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.EIGHTH)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.HALF)
[console]::beep($Notes.CC, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
 
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.HALF)
}

Play-JingleBells

# Turkish Anthem

powershell.exe -enc JABhAD0AMgA5ADMALAA0ADQAMAAsADQANAAwACwANAA0ADAALAA0ADQAMAAsADQANAAwACwANAA0ADAALAA0ADYANgAsADQANAAwACwAMwA5ADIALAA0ADYANgAsADQANAAwACwAMgA5ADMALAA0ADQAMAAsADQANAAwACwANAA0ADAALAA0ADQAMAAsADQANAAwACwANAA0ADAALAA0ADYANgAsADQANAAwACwAMwA5ADIALAA0ADYANgAsADQANAAwACwANAA0ADAALAA1ADgANwAsADUAMgAzACwANAA2ADYALAA0ADQAMAAsADMAOQAyACwANAA0ADAALAAzADkAMgAsADMANAA5ACwAMwAyADkALAAzADQAOQAsADQANAAwACwAMgA5ADMALAA0ADQAMAAsADMAOQAyACwAMwA0ADkALAAzADIAOQAsADIAOQAzACwAMwA0ADkALAAzADIAOQAsADIAOQAzACwAMgA2ADEALAAyADkAMwA7ACQAYgA9ADgAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA5ADAAMAAsADgAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA5ADAAMAAsADgAMAAwACwAOAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwAOAAwADAALAA5ADAAMAAsADgAMAAwACwAOAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwANAAwADAALAA0ADAAMAAsADQAMAAwACwAOAAwADAAOwAkAGMAPQBAACgAMAAuAC4ANAA2ACkAOwAkAGMALgBGAG8AcgBFAGEAYwBoAHsAWwBDAG8AbgBzAG8AbABlAF0AOgA6AEIAZQBlAHAAKAAkAGEAWwAkAF8AXQAsACQAYgBbACQAXwBdACkAfQA=

References

https://medium.com/@bmerenler/powershell-intro-with-simple-beep-music-71535383e017

https://social.technet.microsoft.com/wiki/contents/articles/20989.music-from-the-command-line-performed-by-powershell.aspx

Thursday, July 25, 2019

Work Day PowerShell

$URL = "https://lms.nhcms.net/" #Replace this link with your calendar page (they hardcode your id in the URL)
$Username = "Username" #Replace Username with your LMS Username
$Password = "Password" #Replace Password with your LMS Password

$IE = New-Object -ComObject internetexplorer.application
$IE.visible = $true
$IE.navigate($URL)

While ($IE.Busy -eq $true) {
     Start-Sleep -Seconds 1
} #End while (this is needed to pause internet explorer so it can add the data to the fields.

$IE.document.IHTMLDocument3_getElementByID("UserName").Value = $Username
$IE.Document.IHTMLDocument3_getElementByID("Password").Value = $Password
($IE.Document.IHTMLDocument3_getElementsByTagName("Input") | Where-Object {$_.type -eq "submit" -and $_.value -eq "Login"} | Select-Object -First 1).Click()  #Needed because the LMS does not have ID or Name fields for their buttons


The above script will auto login to a webpage, in this case our LMS system. This uses IE Com object for logging into a website. It only works with IE (no chrome or edge). I use this in a Powershell module called Start-Workday which loads my admin tools I use for the day.

I also created a shortcut for Start-Workday and renamed the script to Work day. This allows me say “Cortana, Start Work day” and Cortana ends up opening IE (LMS site), Edge (Helpdesk ticket system), Outlook, Skype for Business, and Microsoft Teams. There is also an End-Workday module which closes these applications.

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