The Scottish disclosure scheme for domestic abuse, also known as Clare's Law, will run for six months from late November in the two areas.
Clare's Law is named after Clare Wood, 36, who was strangled and set on fire by her ex-boyfriend George Appleton at her home in Salford, Greater Manchester, in 2009.
Miss Wood, a mother-of-one whose father, Michael Brown, is from Aberdeen, had met Appleton on Facebook, unaware of his horrific history of violence against women, including repeated harassment, threats and the kidnapping at knifepoint of one of his ex-girlfriends.
Police Scotland said the pilots would be evaluated before a potential roll-out of the scheme across Scotland next year.
Assistant Chief Constable Wayne Mawson said: "I believe the introduction of the disclosure scheme for domestic abuse in Scotland will not only provide a mechanism to share relevant information about a partner's abusive past with their potential victims, it will give people at risk of domestic abuse the information to assist in making an informed decision on whether to continue in the relationship.
"I would like to reassure communities the length and breadth of the country that while the pilot is running, and subsequently being evaluated, that it will be business as usual for Police Scotland in helping people through the ordeal of domestic abuse."
Under the legislation, family and members of the public concerned about a person, as well as public authorities such as the police or social work, will also have the right to request information.
Justice Secretary Kenny MacAskill said: "It is only right that people in relationships should have the opportunity to seek the facts about their partner's background if, for example, they suspect their partner has a history of violent behaviour.
"Tackling domestic abuse is a top priority for the Scottish Government and we have provided record funding to tackle violence against women, including domestic abuse with £34.5 million allocated for 2012-15 - an increase of 62% since 2007."
Police Scotland said the two pilot areas were chosen because they have a "wide and varied cross-section of the population" who may benefit, as well as a good mixture of potential partner organisations.
The scheme was previously tested in England and Wales, and has been rolled out across police forces south of the border.
Scottish Conservative leader Ruth Davidson previously pressed the Scottish Government to follow the example south of the border.
She said: "Clare's Law has been trialled in other parts of the UK and we know that it works.
"Scotland could not afford to be left behind on this and I'm glad this pilot has been confirmed.
"We need to monitor it carefully and hopefully we'll see a reduction in domestic abuse cases which would enable it to be rolled out across Scotland.
"A third of all domestic abuse is conducted by those who have a history of such violence and this law gives people protection from those individuals."