osname.psm1

cls
function get-osname
{
    $osname=Get-WmiObject -Class win32_operatingsystem
    $osname.caption
}