Hello @MS-Marox ,
I am pretty new using PS Universal.
Application was setup using the GUI
#Application Theme
$appication_theme = @{
Palatte = @{
primary = @{
main = "#D3D3D3"
}
background = @{
sub = "ffffff"
}
}
}
#Get Application Page
New-UDApp -Title “AD User Lockout Status” -Theme $appication_theme -Pages @(
get-UDPage -Name "pg_acc_lockout_status"
get-UDPage -Name "Reset_User_Account"
)
Again grom the GUI I created the pages.
I also have functions in the Modules Tab.
Have four functions which I in the
#Validate Account username
function Check_User_Account {
param($input_user_account)
try {
$check_account_validity = (get-ADUser -Filter {samaccountname -eq $input_user_account}).samaccountname
if (-not \[string\]::IsNullOrEmpty($check_account_validity)) {
return $true
} else {
return $false
}
} catch {
show-UDToast -Message "$($input_user_account) is not a valid account" -Position "center" -Balloon -BackgroundColor "red" -MessageColor "white"
}
}
#Function to get account status
function Get_Account_Status {
param ($in_User_account)
#Get All the DC's in the Forrest
$all_domain_ctrls = Get-ADDomainController -Filter \*
#Empty Array to hold account status
$user_account_state_all_dc = @()
#Display waiting Message
show-UDToast -Message "Retreiving Account Lockout Information, Please Wait.... " -BackgroundColor "blue" -MessageColor "white" -Position "center" -Id "Loading" -Duration 25000
$get_user_password_expiry_date = Get-ADUser $in_User_account -Properties msDS-UserPasswordExpiryTimeComputed | Select-Object name,{\[datetime\]::FromFileTime($\_."msDS-UserPasswordExpiryTimeComputed")}
#Format Password Date
$format_password_expiry = $get_user_password_expiry_date.'\[datetime\]::FromFileTime($\_."msDS-UserPasswordExpiryTimeComputed")'
foreach ($d_ctrl in $all_domain_ctrls) {
#Domain Account Details
$get_dc_name = $d_ctrl.Name
$get_dc_site = $d_ctrl.Site
$get_user_state = Get-ADUser $in_User_account -Properties PasswordLastSet, LockedOut, badPwdCount, lockoutTime -Server $d_ctrl.hostname | Select-Object PasswordLastSet, LockedOut, badPwdCount, lockoutTime
$get_user_password_last_set = $get_user_state.PasswordLastSet
$get_user_lockout_state = $get_user_state.LockedOut
$get_user_bad_password_count = $get_user_state.badPwdCount
$get_user_lockout_time = $get_user_state.lockoutTime
#Create user accountstate object
$user_state_obj = \[PSCustomObject\]@{
"DC Name" = $get_dc_name; Site = $get_dc_site; "Locked" = $get_user_lockout_state; "Bad Pwd Count" = $get_user_bad_password_count; "Password Last Set" = $get_user_password_last_set; "Lockout Time" = $get_user_lockout_time; "Password Expires" = $format_password_expiry
}
$user_account_state_all_dc += $user_state_obj
}
#Clear The Display Information
hide-UDToast -Id "Loading"
#Return Account Status
return $user_account_state_all_dc
}
#Function to unlock account
function Unlock_User_Account {
param ($in_username)
try {
#Command to unlock Add Account accross all domains
unlock-ADAccount $in_username -Confirm:$false
#Display Unlock Command State
show-UDToast -Message "$($in_username) unlocked successfully" -Position "center" -BackgroundColor "green" -MessageColor "white" -Duration 3000
} catch {
#Display Error
show-UDToast -Message "Access Denied" -Position "center" -BackgroundColor "red" -MessageColor "white" -Duration 5000
}
}
The Reset Password was a new Page Was Just setting up:
Test code:
new-UDGrid -Container -Spacing 3 -Children {
new-UDGrid -Item -ExtraSmallSize 12 -Children {
new-UDTypography -Id "test" -Text "Hello Word"
}
}
This is all I have at the moment.
Thanks Again