This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProductName;LicensePartNumber;LicenseSKUID | |
APP CONNECT IW;SPZA_IW;8f0c5670-4e56-4892-b06d-91c085d7004f | |
Microsoft 365 Audio Conferencing;MCOMEETADV;0c266dff-15dd-4b49-8397-2bb16070ed52 | |
AZURE ACTIVE DIRECTORY BASIC;AAD_BASIC;2b9c8e7c-319c-43a2-a2a0-48c5c6161de7 | |
AZURE ACTIVE DIRECTORY PREMIUM P1;AAD_PREMIUM;078d2b04-f1bd-4111-bbd4-b4b1b354cef4 | |
AZURE ACTIVE DIRECTORY PREMIUM P2;AAD_PREMIUM_P2;84a661c4-e949-4bd2-a560-ed7766fcaf2b | |
AZURE INFORMATION PROTECTION PLAN 1;RIGHTSMANAGEMENT;c52ea49f-fe5d-4e95-93ba-1de91d380f89 | |
DYNAMICS 365 CUSTOMER ENGAGEMENT PLAN ENTERPRISE EDITION;DYN365_ENTERPRISE_PLAN1;ea126fc5-a19e-42e2-a731-da9d437bffcf | |
DYNAMICS 365 FOR CUSTOMER SERVICE ENTERPRISE EDITION;DYN365_ENTERPRISE_CUSTOMER_SERVICE;749742bf-0d37-4158-a120-33567104deeb | |
DYNAMICS 365 FOR FINANCIALS BUSINESS EDITION;DYN365_FINANCIALS_BUSINESS_SKU;cc13a803-544e-4464-b4e4-6d6169a138fa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-VMInventory { | |
<# | |
.SYNOPSIS | |
Retrieves detailed information about VMs from Hyper-V host or cluster | |
.DESCRIPTION | |
Retrieves information about a VM, it's disk, path, current resources and network properties. | |
Will query Hyper-V host or all nodes in a cluster if [$Cluster] is provided. Accepts [$Credential] parameter. | |
.PARAMETER ComputerName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERBOSE: Processing Computer {HyperV} with default credentials of user {mczerniawski_admin} | |
VERBOSE: Processing adding new VHDX Disk to VM {VMName1} on Computer {HyperV} | |
VERBOSE: Getting VM {VMName1} properties from Computer {HyperV} to set Path for new VHDX | |
VERBOSE: Setting disk type to {Dynamic} for {VMName1} on Computer {HyperV} | |
VERBOSE: Creating new VHDX in {C:\AdminTools\VMName1\Virtual Hard Disks\VMName1_disk1.vhdx} for {VMName1} on Computer {HyperV} | |
Number : | |
PSComputerName : HyperV | |
RunspaceId : 7acbb7e4-efc4-4222-93c9-f75618873037 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#optional | |
#$Creds = Get-Credential #Credki do VM - moga byc domenowe lub lokalne | |
$NewVMDiskProps = @{ | |
VMProps = @{ | |
ComputerName = 'HyperV' | |
VMName = 'VMName1' | |
} | |
VHDProps = @( | |
@{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-AHVMDisk { | |
<# | |
.SYNOPSIS | |
Adds a new vhdx to Hyper-V VM | |
.DESCRIPTION | |
Creates a new VHDX in VM's default disk location with given size (VHDSize). Attaches to a VM. | |
.PARAMETER ComputerName | |
ComputerName of a HyperV Computer where VM is. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ComputerPSSession = New-PSSession -ComputerName $ServerList.servers.server.name -Credential $Credential | |
$params =@( | |
@{ | |
ComputerName = 'ComputerName1' | |
Counter = $MetricList | |
SampleInterval = 3 | |
MaxSamples = 3 | |
}, | |
@{ | |
ComputerName = 'ComptuerName2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($server in $ServerList) { | |
#Generate all variables | |
$resultCounters = Invoke-Command -ComputerName $server -Credential $Credential -ScriptBlock { | |
param( | |
$MetricList | |
) | |
Get-Counter -Counter $MetricList -SampleInterval 10 -MaxSamples 10 | |
} -ArgumentList $MetricList | |
$resultCounters | Export-Counter -Path $path -FileFormat $fileFormat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$UsersToClean = Get-Content -Path 'c:\AdminTools\disabled_onlinemembership.json ' -RAW | ConvertFrom-Json | |
#Remove from groups | |
foreach ($onlineUser in $UsersToClean) { | |
Write-Host "Processing user {$($onlineUser.DisplayName)}" | |
foreach ($group in $onlineUser.AADGroupID) { | |
Write-Host " Processing group {$($group)}" | |
Remove-AzureADGroupMember -ObjectId $group -MemberId $onlineUser.AADUserObjectID | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$disabled_OnlineMembership | ConvertTo-Json -Depth 99| Out-File c:\AdminTools\disabled_onlinemembership.json | |
#Export For further 'human' processing through excel: | |
$disabled_OnlineMembership | Select-Object UserName,DisplayName,Enabled,UserDN,AADUserObjectID, | |
@{n='Groups';e={$_.GroupName -join ','}}, | |
@{n='GroupMail';e={$_.GroupMail -join ','}} | | |
Export-Csv -Path c:\AdminTools\disabled_onlinemembership.csv -NoTypeInformation | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get Credentials to O365 tenant | |
$credential = Get-Credential | |
Connect-AzureAD -Credential $credential | |
$disabled_OnlineMembership = foreach ($user in $disabledUsers) { | |
if ($user.UserPrincipalName) { | |
$userObjectId = Get-Msoluser -UserPrincipalName $user.UserPrincipalName | Select-Object -ExpandProperty ObjectId | |
$group = Get-AzureADUserMembership -ObjectId $userObjectId | Select-Object * | Where-Object {-not ($_.DirSyncEnabled)} | |
if ($group) { | |
[pscustomobject]@{ | |
UserName = $user.SamAccountName |
NewerOlder