Resize Ubuntu disk in VMware

After you have resized the disk in VMware, you will need to login as super user in Linux. Then check to see the size:

df -h

You should see the disk “/dev/mapper/ubuntu–vg-ubuntu–lv” as the one mapped as root, and is low on disk space.

Run the following (parted my not be needed, USE SNAPSHOTS!!!):

parted

>>resizepart
>>quit


lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Now check:

df -h

Useful commands

lsblk /dev/sda
partprobe -s
unit s print free

Logging into Office 365 with Powershell

Make sure you have all the modules:

Install-Module -Name MSOnline
Install-Module -Name AzureAD 

Then Login

$objCred = Get-Credential
$objSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $objCred -Authentication Basic -AllowRedirection
Import-PSSession $objSession

#Add compliance center
$objSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $objCred -Authentication Basic –AllowRedirection
Import-PSSession $objSession 

Adding licenses to Office 365 users based upon AD group

Not a whole lot of documentation here, just slice and dice as you see fit.

In the environment that this was created in, all Office 365 users are in the group “SyncWithO365” (this is the sync group for Azure AD Connect). Most users receive an Exchange Online 1 license. The users that receive an E3 license are in O365E3License group. This script will take those two groups and issue Office 365 EO1 and E3 licenses accordingly.

#config

#tenant name (before the .onmicrosoft.com)
$strTenant = "awesomeCorp" 

#admin account on 365 to issue licenes with
$str365UserName = "[email protected]"
$str365Password = "password123"


$str365AllUsersGroup = "SyncWithO365"
$str365EnterpriseUsersGroup = "O365E3License"

##########################
# Do not edit below this #
##########################

#all users that were not in 365
$objFailedUsers = New-Object System.Collections.ArrayList($null)

#loggin function
function Go-Logit
{
    Param([string]$LogEntry)
    $strTime = get-date -f MM-dd-yyyy:HH:mm:ss
    write-host $strTime ":" $LogEntry
}

#set the license function
function Set-License365
{
    Param ([bool]$StandardLicense,
    [string]$User)

    #Get-MsolAccountSku
    #setup the SKU's
    $strEnterprise = $strTenant + ":" + "ENTERPRISEPACK"
    $strStandard = $strTenant + ":" + "EXCHANGESTANDARD"

    $blUserIsIn365 = $true
    #get the user license
    $objUserLic = Get-MsolUser -UserPrincipalName $User

    if($objUserLic -eq $null)
    {
        Go-Logit -LogEntry "$User isn't in 365"
        $objFailedUsers.Add($User)
        $blUserIsIn365 = $false
    }
    
    if($blUserIsIn365 -eq $true)
    {
         #if we dont have a license
        if($objUserLic.IsLicensed -eq $true)
        {
            Go-Logit -LogEntry "$User : License found"
            #we have a license, so now we need to check it its correct
            $blEntLicenseFound = $false #enterprise license
            $blStaLicenseFound = $false #standard license
            foreach($objLicense in $objUserLic.Licenses)
            {
                #$objLicense
                if($objLicense.AccountSkuId -eq $strEnterprise)
                {
                     Go-Logit -LogEntry "$User : Seems to be enterprise"
                    $blEntLicenseFound = $true
                }
                if($objLicense.AccountSkuId -eq $strStandard)
                {
                    Go-Logit -LogEntry "$User : Seems to be standard"
                    $blStaLicenseFound = $true
                }
            }
            #if this is a standard license user
            if($StandardLicense -eq $true)
            {
                #if a enterprise license was found, we need to replace it
                if($blEntLicenseFound -eq $true)
                {
                    Go-Logit -LogEntry "$User : Replacing enterprise with standard"
                    Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $strStandard -RemoveLicenses $strEnterprise
                }
                else
                {
                    Go-Logit -LogEntry "$User : The correct license was found"
                }
            }
            #this must be a enterprise user
            else
            {
                #if a standard license was found, we need to replace it.
                if($blStaLicenseFound -eq $true)
                {
                    Go-Logit -LogEntry "$User : Replacing standard with enterprise"
                    Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $strEnterprise -RemoveLicenses $strStandard
                }
                else
                {
                    Go-Logit -LogEntry "$User : The correct license was found"
                }
            }
        }
        else
        {
            #no license was found, need to add one
            Go-Logit -LogEntry "No license found"
            #if this is a standard license user
            if($StandardLicense -eq $true)
            {
                Go-Logit -LogEntry "$User : Setting a standaed license"
                Set-MsolUser -UsageLocation US -UserPrincipalName $User
                Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $strStandard
            }
            #must be an enterprise
            else
            {
                Go-Logit -LogEntry "$User : Setting a enterprise license"
                Set-MsolUser -UsageLocation US -UserPrincipalName $User
                Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $strEnterprise
            }
        }
    }
}

#get Exchange Online E1 users 
$obj365UsersArr = @(Get-ADGroupMember -identity $str365AllUsersGroup -Recursive | get-aduser | select -Expand UserPrincipalName)
$obj365Users = New-Object System.Collections.ArrayList(,$obj365UsersArr)

#get E3 users
$obj365e3UsersArr = @(Get-ADGroupMember -identity $str365EnterpriseUsersGroup -Recursive | get-aduser | select -Expand UserPrincipalName)
$obj365e3Users = New-Object System.Collections.ArrayList(,$obj365e3UsersArr)

#enumerate through all E3 users and remove them from the group that contains all users
#the result,  $obj365Users will only have people not in the e3 group
foreach($objE3User in $obj365e3UsersArr)
{
    $obj365Users.Remove($objE3User)
}

#create credentials to speak with office 365
$objPassword = $str365Password | ConvertTo-SecureString -asPlainText -Force
$objCredential = New-Object System.Management.Automation.PSCredential($str365UserName,$objPassword)
Import-Module MSOnline
Connect-MsolService -Credential $objCredential

Go-Logit -LogEntry "----------------------Pushing licenses for Standard users"
#standard users
foreach($objUserTemp in $obj365Users)
{
    Set-License365 -User $objUserTemp -StandardLicense $true

}

Go-Logit -LogEntry "----------------------Pushing licenses for Enterprise users"
#Enterprise users
foreach($objUserTemp in $obj365e3Users)
{
    Set-License365 -User $objUserTemp -StandardLicense $false

}

Go-Logit -LogEntry "----------------------Listing all users that were not in 365"
#log the users that were not in 365
foreach($objUserTemp in $objFailedUsers)
{
    Go-Logit -LogEntry "$objUserTemp was not found in 365, check group membership"

}

Adding Send-As permissions to a contact in Office 365

First, make sure you have the contact in 365. Get the contact identity.

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-Recipient

The identity is the name column.

Add-RecipientPermission "" -AccessRights SendAs -Trustee ""

User being the person that needs to SendAs.

Printers as admin

If you ever need to install a local printer on a Windows 7/8 machine without giving the user admin, or logging the user out, you can runas this command to modify printers;

RUNDLL32 PRINTUI.DLL,PrintUIEntry

Here is how I add a new printer as another user;

Run add printer wizard locally:

rundll32 printui.dll,PrintUIEntry /il

Sharepoint

 This is a Powershell script to change the title bar on a SharePoint 2013 webpage (the upper left side).

$url = "http://websiteURL"
$text = "Text Goes here!"

$wa = Get-SPWebApplication $url
$wa.SuiteBarBrandingElementHtml = "
$text
" $wa.Update()

Windows network password manager

If you have a computer connected to a domain and you would like to store alternate credentials to servers, you would normally go into your control panel, and edit your account. This isn’t available to you when you’re on a domain. This command will give you access to the “Windows Store Credentials”. This will let you store server passwords on your computer if you want to access servers in other domains, and don’t want to get prompted for credentials every time.

rundll32.exe keymgr.dll, KRShowKeyMgr