I've created the following Powershell script which will uninstall all versions of VMware Tools from a server. Particularly handy for SCCM deployment. uninstall_vmware_tools.ps1 $regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $regkey = gci $regpath | Get-ItemProperty | Where-Object{"VMware Tools" -contains $_.DisplayName} #Uninstall String msiexec /x $regkey.PSChildName /qn #Reboot server within 120 seconds. shutdown -r -f -t 120 The … Continue reading Universal VMware Tools Uninstaller
PowerShell
Home Folder – Compare folders against current domain users
Here is a PowerShell script which probes network home folders with users against the domain. Helpful in order to determine which home folders no longer reference current user accounts and which can safely be removed/archived. $folders = gci "\\Domain.Local\DFS\Users" #This is the root path containing home folders. foreach ($folder in $folders) { $username1 … Continue reading Home Folder – Compare folders against current domain users
Home Folder – Archiving Disabled Users
Here is aPowerShell script to archive all users within an organisational unit (Disabled Users) to a network path. Prerequisite is to grant your Administrator account with ownership/full control permissions to home folders in question prior move. If this condition is not met, then original home folders will remain with remnant data which was inaccessible. $users … Continue reading Home Folder – Archiving Disabled Users
Exchange 2013 – Archiving Disabled Users
Here is an Exchange Shell script to archive all users within an organisational unit (Disabled Users) to a network path. Prerequisite is to grant built-in security group Exchange Trusted Subsystem with modify access to network path. $mailboxes = Get-mailbox –OrganizationalUnit “DOMAIN.LOCAL/CompanyName/Disabled Users” foreach ($mailbox in $mailboxes) { $name = $mailbox.Name if(!(Test-Path "\\[FILESERVER]\Archive$\$name\")) { … Continue reading Exchange 2013 – Archiving Disabled Users
PowerShell AD Manager Report
We can generate a list of users and their corresponding managers entered against AD user objects by using Powershell. echo user1, user2, user3 | get-aduser -Properties manager | Select-Object -Property Name, @{label='Manager';expression={$_.manager -replace '^CN=|,.* Replace user1, user2, user3 with usernames of objects. We can export this list by adding the line | Export-CSV "C:\LineManagers.csv" … Continue reading PowerShell AD Manager Report
Connecting PowerShell to Azure (Office 365)
First install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW from the Microsoft Download Center. Then install the Azure Active Directory Module for Windows PowerShell (64-bit version), and click Run to run the installer package. Before you can run any of the cmdlets discussed in this article, you must first connect to your … Continue reading Connecting PowerShell to Azure (Office 365)
Connecting PowerShell to Office 365
On your local computer, open Windows PowerShell and run the following command. $UserCredential = Get-Credential In the Windows PowerShell Credential Request dialog box, type your Exchange Online user name and password, and then click OK. Run the following command. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Note If you are an Office 365 operated … Continue reading Connecting PowerShell to Office 365