$PropSplat = @(
'Name'
'Status'
@{
Name = 'BoolStatus'
Expression = {
if($PSItem.Status -eq 'Running'){$false}else{$true}
}
}
)
Get-Service m* | Select-Object $PropSplat
$PropSplat = @(
'Name'
'Status'
@{
Name = 'BoolStatus'
Expression = {
if($PSItem.Status -eq 'Running'){$false}else{$true}
}
}
)
Get-Service m* | Select-Object $PropSplat
in order to find and return a specific line from a csv file (data)
$Recepies = Iomport-CSV C:\temp\recepies.scv
$Recepies.Where({$PSItem.Ingredient_1 -eq 'potato'})
in order to use nslookup with arguments
nslookup -type=NS microsoft.com
nslookup -type=NS microsoft.com ns1-205.azure-dns.com
use this command to modify TLS settings if you get an error running the below commands
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
search for all available package providers
Find-PackageProvider
search for a specific package provider
Find-PackageProvider -name nuget
install a package provider
Install-PackageProvider -Name nuget
after you have a package provider setup you can search for packages
search for a specific package. it supports wildcard in name
Find-Package -Name *AzureAD*
install package
Install-Package -Name AzureAD
modify TLS settings if you get errors running commands below
[Net.ServicePointManager]::SecurityProtocol
= [Net.SecurityProtocolType]::Tls12
Install-Module -Name MSOnline
(from https://www.powershellgallery.com )
Connect-MsolService
$AllMsolUsers = Get-MsolUser -All
$AllToModify = $AllMsolUsers | Where-Object -FilterScript { ($PSItem.Licenses.AccountSkuId -eq 'o365:STANDARDPACK') -and ($PSItem.UserType -eq 'Member') -and $PSItem.IsLicensed}
foreach($User in $AllToModify){
if($User.UserPrincipalName.Contains('@o365.onmicrosoft.com')){
$NewPrincipal = $User.UserPrincipalName.Replace('@o365.onmicrosoft.com','@domain.com')
Set-MsolUserPrincipalName -NewUserPrincipalName $NewPrincipal -UserPrincipalName $User.UserPrincipalName
}
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$GroupDataObjectHash = [ordered]@{}
$GroupDataObject.PSObject.Properties.Name | %{$GroupDataObjectHash.Add($PSItem, $GroupDataObject.$PSItem)}