# -*- coding: utf-8 -*-

# ./ucs-winrm.py run-ps  --cmd 'set-GPPrefRegistryValue -Name "FB1" -Context User -key "HKCU\Environment" -ValueName MYUSERGPO -Type String -value TEST2 -Action Update'
# ./ucs-winrm.py run-ps  --cmd "Get-ChildItem Env:"

name = 'check-share'
description = 'check share file for sambatest'
args = dict(
	filename=dict(help='name of the directory', required=True),
	server=dict(help='host server', required=True),
        sharename=dict(help='file share name', required=True),
        username=dict(help='log on as user', required=True),
	userpwd=dict(help='password for user', required=True),
        driveletter=dict(help='the letter for the share', required=True),
)
ps = '''
$passwd = convertto-securestring -AsPlainText -Force -String %(userpwd)s
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "SAMBATEST\%(username)s",$passwd
New-PSDrive -Name %(driveletter)s -PSProvider FileSystem -Root \\\\%(server)s\\%(sharename)s -Credential $cred
Get-Content %(driveletter)s:\\%(filename)s
'''
