in – Mohammed Wasay https://www.mowasay.com Wed, 12 Apr 2017 15:38:28 +0000 en-US hourly 1 https://wordpress.org/?v=7.1 https://www.mowasay.com/wp-content/uploads/2016/09/cropped-me-32x32.jpg in – Mohammed Wasay https://www.mowasay.com 32 32 Outlook 2016: Remove Duplicate entries in Room Finder https://www.mowasay.com/outlook-2016-remove-duplicate-entries-in-room-finder/ Wed, 12 Apr 2017 15:38:28 +0000 https://www.mowasay.com/?p=819 In Outlook 2016 some users may noticed dual entries in the Room List:

The room list behavior that we see  in Outlook is by design. When we  use a Room List  for a meeting, it is stored in the  Most Recently Used entries in the registry. When we create a new meeting, we will see this MRU entry in the top of the Room Lists . The same Room List will be seen again in the drop down which is accessed from the Exchange Server/ Online.

To prevent the duplicate entries seen in the Room List, create the below registry entry with blank data to disable the  Most Recently Used  Room List in Outlook.

Path: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Preferences

Key: RoomFinderRecentRooms
Key: RoomFinderRecentRoomList

If these entry already exist just empty the values.

After Outlook Restart:

 Only single instance of the rooms list now showing! 🙂

]]>
Creating Security Groups for File Shares in Bulk using PowerShell https://www.mowasay.com/creating-security-groups-for-file-shares-in-bulk-using-powershell/ Wed, 08 Feb 2017 22:29:03 +0000 https://www.mowasay.com/?p=735 Security Groups are great for managing large groups for permissions.  A client requested that they needed to have Read-Only, Read-Write, and Ready-Modify (allow for deleting) for all their file shares for better management.

Getting the Share Names

In order for me to create the groups I needed the share names. PowerShell to the rescue!

Type the following on the File Server/ Cluster to list all the shares and capture the output in a text file:

WmiObject -class Win32_Share -computer <yourfileserver.fqdn) | Out-File c:\scripts\shares.txt

[su_note note_color=”#fafae8″]On your file-server you may have a lot of share but for example purposes I am showing just one.[/su_note]

Output should be similar to:

Cleaning up the Share Names

Now that we have the Share names we need to do a bit of cleanup to avoid having duplicates.

  • We need to remove all entries for hidden shares “$”
  • We need to remove duplicates
  • We need to change the case of the share names to lower case. ( I prefer lowercase but you can decide to do what best fits your needs)

Follow my guide to removing duplicates in a text file using NotePad++

Once the sharenames are clean save it to a text file.

Client Requirement for the Security Groups:

For each file share there are three security groups needed:

  • <Sharename>_RO : Read-Only
  • <Sharename>_RW : Read & Write
  • <Sharename>_RM : Read & Modify

For PowerShell to do this I needed to create a .CSV file with all the security group entries.  Now, there are many ways this can be done. I will share what I have been doing.

Open up Microsoft Excel and copy the share on a column to the right (lets say K2)

Now on Cell A2 your value should be =CONCATENATE(K2,”_RW”) and drag it down.

It should look something like this:

Do the same for RO & RM. Now you have all the security groups names you need to create.

Create a file called FileShares_Groups.csv  using the following format.

Create the file Create Security Groups for File Shares.ps1

.NOTES
	File Name:
	Author: Mohammed Wasay
	Contact Info:
		Website:www.mowasay.com
		Twitter:@wasay
	Requires:
	Tested:
.PARAMETER
    None

.EXAMPLE
    .\Create Security Groups for File Shares.ps1
#>
#Import Active Directory Module
Import-Module ActiveDirectory

$csv = Import-Csv -Path "c:\scripts\FileShares_Groups.csv"

ForEach ($item In $csv)
    {
        $create_group = New-ADGroup -Name $item.GroupName -GroupCategory $item.GroupCategory -groupScope $item.GroupScope -Path $item.OU
        Write-Host -ForegroundColor Green "Group $($item.GroupName) created!"
    }

Copy the two files: FileShares_Groups.csv & Create Security Groups for File Shares.ps1  into a folder called C:\scripts  on the Domain Controller.

Run the PowerShell script and see the security groups get created.

 

 

]]>
Find out ‘in cloud’ Distribution Groups https://www.mowasay.com/find-in-cloud-only-distribution-groups/ Thu, 03 Nov 2016 17:12:56 +0000 https://www.mowasay.com/?p=688 Microsoft Teams was announced yesterday and many want to jump right in. I noticed when users wanted to create teams, new distribution groups started getting added. I wanted to find out my ‘In cloud’ distribution groups and was surprised there was no property for the item.

633466

 

I was able to find out the groups using the following:

Get-MsolGroup -All | where {$_.lastdirsynctime -eq $null}

This listed the information I needed to clean up groups.

You may also want to disable ‘group creation’ for users. Read how to do that here.

 

]]>
Create a Virtual Machine with 2 NICs in Azure Classic https://www.mowasay.com/create-a-virtual-machine-with-2-nics-in-azure-classic/ Tue, 01 Nov 2016 21:42:38 +0000 https://www.mowasay.com/?p=685 Unfortunately, in Azure you cannot create a Virtual Machine in the GUI with 2 Network Cards. You cannot even add a 2nd NIC to a VM once it has been created. The only way to create a VM with 2, is to specify the additional NIC’s at the time of creation and ONLY via powershell. I have compiled a Powershell script that will do this. I have also listed the commands next to each comment to get the value to put there. Copy the code below into a PS1 and launch it from a PowerShell window.

############## Change Values Below Here #############

# Set Subscription that will be used. Get-AzureSubscription
$subscr="Free Trial"

# Cloud Service Name. Get-AzureService
$svcname="Cloud Service"

#Set Storage Account VM will be created in. Get-AzureStorageAccount
$staccount="Storage01"

# Name of the VM Provisioned
$vmname="VM01"

# Instance Size of the VM required
$vmsize="Standard_DS2_v2"

# Virtual Network Name. Get-AzureVNetConfig
$vnetname="Virtual Network"

# OS you want to Deploy
# 2012 = "Windows Server 2012 R2 Datacenter"
# 2008 = "Windows Server 2008 R2 SP1"

$OSversion = "Windows Server 2008 R2 SP1"

# vNic1 IP Address
$vNic1IP = "10.0.2.11"
$vNic1Subnet = "Live"

# vNic2 IP Address
$vNic2Name = "Replication"
$vNic2IP = "10.0.1.11"
$vNic2Subnet = "Replication"

############# DO NOT CHANGE VALUES BELOW HERE ############

# Select Subscription and Storage
Set-AzureSubscription -SubscriptionName $subscr -CurrentStorageAccountName $staccount

# Get image for VM
$image = Get-AzureVMImage `
| where{$_.ImageFamily -eq $OSversion} `
| sort PublishedDate -Descending `
| select -ExpandProperty ImageName -First 1

# Creates a new VM config with the VM name, its Size and the Image Used
$vm1 = New-AzureVMConfig -Name $vmname -InstanceSize $vmsize `
-Image $image

# Asks you for the admin username and password for the machine

$cred=Get-Credential -Message "Type the name and password of the local administrator account."
$vm1 | Add-AzureProvisioningConfig -Windows -AdminUsername $cred.Username -Password $cred.GetNetworkCredential().Password

###### 2nd Network Card - Remove comments on next 2 lines if you need a 2nd NIC #

#Add-AzureNetworkInterfaceConfig -Name $vNic2Name `
# -SubnetName $vNic2Subnet -StaticVNetIPAddress $vNic2IP -VM $vm1

# Create vNic1 - Will be the Default Gateway so assign to Correct Subnet
Set-AzureSubnet -SubnetNames $vNic1Subnet -VM $vm1
Set-AzureStaticVNetIP -IPAddress $vNic1IP -VM $vm1

New-AzureVM -ServiceName $svcname –VNetName $vnetname –VMs $vm1
]]>
Active Directory: Changing passwords for users in bulk using a .csv file https://www.mowasay.com/active-directory-changing-passwords-for-users-in-bulk-using-a-csv-file/ Thu, 13 Oct 2016 21:49:18 +0000 http://www.mowasay.com/?p=671 Many accounts in your AD might need a password change. What if you want to do this in bulk ?

First, we need to the userlist. Depending on your requirements we need to get a list of users (specifically samaccountname). For random password generation I recommend using http://manytools.org/network/password-generator/ as it can generate up 1000 for free.

Here is what my UserList.csv look like:

sAMAccountName,Password
test1,gqLfZub$OtO#dBg
test2,6eXq78gTyx$YjmM
test3,ZNgl!KdYo7U6yzR
test4,voiIs!TISw!Wcyc
test5,W7ZBTAe7CWcFzyn
test6,BykgCY5b*NGFO5!
test7,3ApLlchwgRQwf1P
test8,9jZvvR2$wDggf3M
test9,*QCDjcgnNLkBDP1
test10,sZpvUnvjJxAE9HE
test11,$C8TX!tcS3d#MjK
test12,Pzw*aH6zjpOx8Wj
test13,XmfIPiIz82!!X77
test14,ri!!hQX!w!FSZuI
test15,S0Gzf6fEUsG!4Ib
test16,Kj8s!vy94S!ozLJ
test17,PzFzjP7obALeuWa
test18,Ri5V2laxxck6Rgg
test19,Rw8KcX*FoMT#gr1
test20,QDndAgzdYo5CYX!

Make sure you do the following on a domain controller or connecting to your domain controller via PS-remote with elevated permissions.

Run this in PowerShell (Open PowerShell in Admin Mode)

PowerShell:

Import-Module Active Directory
$Resetpassword = Import-Csv "c:\_Scripts\UserList.csv"

foreach ($Account in $Resetpassword) {
    $Account.sAMAccountName
    $Account.Password
        Set-ADAccountPassword -Identity $Account.sAMAccountName -NewPassword (ConvertTo-SecureString $Account.Password -AsPlainText -force) -Reset
}

[su_note note_color=”#fafae8″]-Reset
Specifies to reset the password on an account. (User is not prompted to change password).
To use this parameter, you must set the -NewPassword parameter.
You do not need to specify the -OldPassword parameter.
[/su_note]

]]>
VMware: Intermittent Error: Unexpected character ‘’ (code 65279 / 0xfeff) in prolog; expected ‘ https://www.mowasay.com/vmware-intermittent-error-unexpected-character-%ef%bb%bf-code-65279-0xfeff-in-prolog-expected/ Tue, 04 Oct 2016 16:54:28 +0000 http://www.mowasay.com/?p=650 Recently, I got the error below when using the vSphere client.

Problem:

error

I have only tested this solution on:

2016-10-04_11-41-47

Solution:

Repair your installation of Microsoft Visual J#® 2.0 Redistributable Package – Second Edition (x64)

Download

The error went away after repair.

In trying to google the error some user have reported that uninstall the patch KB3147458 worked for them. I didn’t have the patch.

 wusa.exe /uninstall /KB:3142024

Hope this helps.

]]>
Bulk removal of Password Never Expires checkbox in AD https://www.mowasay.com/bulk-removal-of-password-never-expires-checkbox-in-ad/ Thu, 23 Jul 2015 05:03:29 +0000 http://www.mowasay.com/?p=376 No one intends this but it is a problem that sooner or later you will be come across in your system administrator career.

I’ve see this resolved many different ways, but I like to narrow it down to a particular OU. Depending on your case you may want to clean this across the board in AD.

Here is command prompt to the rescue:

dsquery user "OU=Microsoft,DC=Redmond,DC=CORP,DC=LOCAL" -limit 4000 | dsmod user -pwdneverexpires no

I haven’t tried this, but some have said the following works in Powershell:

For OU:

Get-ADUser -Filter {(ObjectClass -eq "user")} -SearchBase "OU=Offices,DC=Contoso,DC=com" | Set-ADUser -PasswordNeverExpires:$FALSE

For AD:

Get-ADUser -Filter {(ObjectClass -eq "user")} | Set-ADUser -PasswordNeverExpires:$FALSE
]]>