Tag: PowerShell

PS: Enable Remote Access

PS: Enable Remote Access

Quick one liner to setup remote powershell access, If you do have physical access to the machine I would use PSexec to remotely fire the command

# Enable Remote Power shell Access from any host
Enable-PSRemoting -SkipNetworkProfileCheck -Force
# Connect to remote session
New-PSSession ASGLH-WL-19600
Enter-PSSession 1
Advertisements
SCCM: Injecting Lang Packs into WIM The Power Shell Way

SCCM: Injecting Lang Packs into WIM The Power Shell Way

So I have already ran over how to inject the Lang packs using the old DISM command line tools but here is how you do it the power shell way which makes life a little easier and almost any nood can follow

#####################################################################
# Enviroment Setup
# Wim Image Location = C:\TMP\WIM\Install.wim
# Image Mount Location = C:\TMP\MNT
# Image ScratchDirectory = C:\TMP\SRC
# Lang Package Location = C:\TMP\Lang Packs
#
# Remember to use elevated permissions to run these operations
#
#####################################################################
# Show a list of WIM index's within your file
get-WindowsImage -imagepath .\WIM\install.wim
# Remove any none required WIM Index's
remove-windowsimage -imagepath .\WIM\Install.WIM -index 2
# Mount WIM Image
Mount-WindowsImage -ImagePath .\WIM\install.wim -ScratchDirectory .\SRC\ -Path .\MNT\ -Index 1
# Add Packages
Add-WindowsPackage -Path "c:\TMP\MNT" -PackagePath .\package.cab
# Save your changes to the image
Save-WindowsImage -Path "c:\TMP\MNT"
# Unmount the Image
Dismount-WindowsImage -Path "c:\TMP\MNT" -Save
PS: Add delegate to Room Mailbox for booking approval

PS: Add delegate to Room Mailbox for booking approval

Hi Guys

So today whilst at work I had another Powershell challenge to add delegates to our large number of meeting rooms in the exchange estate. See the below for the approach I had taken.

Get-Mailbox -ResultSize unlimited | where {$_.resourcetype -eq "Room"} | Set-Mailbox -GrantSendOnBehalfTo @{add="EndUser@User.com"}

I started out using the below example however this shown to be problematic as this over written the current configuration and does not append permissions.

Get-Mailbox -ResultSize unlimited | where {$_.resourcetype -eq "Room"} | Set-CalendarProcessing –ResourceDelegates "EndUser@User.com"
PS: Enable MFA For All Users O365

PS: Enable MFA For All Users O365

The below script will instruct your PowerShell session to connect to your Office365 environment and enable MFA across all enabled accounts within your estate

# Configuration of Powershell Session
Set-ExecutionPolicy Unrestricted –Scope CurrentUser
# Importation of Modules
Import-Module MSOnline
# User Input for O365 Creds
$UserCredential = Get-Credential
# Powershell Connection Standup with O365
Connect-MsolService –Credential $UserCredential
# Configuration of MFA Enviromental Varibles
$auth = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$auth.RelyingParty = "*"
$auth.State = "Enabled"
$auth.RememberDevicesNotIssuedBefore = (Get-Date)
# Apply MFA to all users
Get-MsolUser -EnabledFilter EnabledOnly -All | Foreach{ Set-MsolUser -UserPrincipalName $_.UserPrincipalName -StrongAuthenticationRequirements $auth}