Levels of care being given to dementia sufferers in specialist NHS units have been criticised in a new report by the Mental Welfare Commission for Scotland.
The report found that while many people are receiving good care, there are units where the care is poor and the rights and dignity of patients are not "adequately respected".
Health Secretary Alex Neil described the report as "very disappointing" and pledged to implement its recommendations.
About 86,000 people in Scotland have dementia and one third of them are in care homes or hospitals.
The commission visited 52 NHS units providing longer-term care for people with dementia during 2013. It reviewed the care of 336 people and spoke to 129 carers and relatives.
It found that 43% of people were not receiving adequate levels of social or recreational stimulation, while 73% had not been on an outing from the unit in the previous three months.
There were significant levels of use of antipsychotics, anxiolytics and sedative antidepressants, often in combination, the report states. These medications all potentially carry risks of side effects, particularly in older people.
Meanwhile, only around half of people had a care plan in place which was " person-centred", reviewed regularly and which considered alternatives to medication.
A quarter of people only had a generic care plan with no "person-centred" information, and one in ten had no care plan at all.
The report was also critical of the environments in some units. Seven units were described as "institutional, bare and stark", while only about half of the units incorporated dementia-friendly environmental features.
Many people were still being cared for in small dormitories with shared facilities, the report found.
Mr Neil told BBC Radio Scotland: "Clearly there is a lot to be done in terms of the hospitals and the private residential care homes where these visits took place."
Commenting on patients not leaving units or having access to outdoor areas, he added: "That's totally unacceptable and I am determined that we implement the recommendations and put an end to such unacceptable practice.
"I am also very determined that we don't just implement the recommendations, we monitor the implementation on a regular basis, because I don't want a future health minister in five or six years' time to have to read another report like this.
"Despite all the criticisms that were made, we were not receiving the level of complaints I would have expected having read this report, so one of the areas I want to see is a much stronger voice for families and carers so that if they identify shortcomings we don't wait for another report, we deal with it there and then."
Alzheimer Scotland said it was "deeply disappointed by the extent of the problems highlighted in the Mental Welfare Commission's report, particularly with regards to ongoing issues with medication, access to specifically-skilled staff and the suitability of care environments".
The charity said failing to follow the proper procedures for prescribing drugs was " unlawful as well as a potential breach of human rights and must cease now".
The Scottish Government said it is investing in education and training for front-line staff, with a further £500,000 of funding for "dementia champions" in hospitals and social care and Alzheimer Scotland's specialist dementia nurses.
Public Health Minister Michael Matheson said: "We know timely diagnosis and post-diagnostic support for dementia is vital, and I'm proud that Scotland is leading the way on this.
"We are committed to transforming dementia services with a range of other activity in our current Dementia Strategy. I am confident that, with the continued support, professionalism and hard work of all those involved, we will continue to improve care and provide better support for people in our communities living with dementia."