Hello,
I want to use this custom function in PSATD Can you help me ?
Function CurrentUser {
$LoggedInUser = get-wmiobject win32_computersystem | Select-Object username
$LoggedInUser = [string]$LoggedInUser
$LoggedInUser = $LoggedInUser.split(β=β)
$LoggedInUser = $LoggedInUser[1]
$LoggedInUser = $LoggedInUser.split(β}β)
$LoggedInUser = $LoggedInUser[0]
$LoggedInUser = $LoggedInUser.split("")
$LoggedInUser = $LoggedInUser[1]
Return $LoggedInUser
}
$user = CurrentUser
#Select-String -Path βC:\Local\igg.txtβ -Pattern β$userβ -Quiet
if(Select-String -Path βC:\Local\igg.txtβ -Pattern β$userβ -Quiet) {write-host βyesβ} Else {write-host βNoβ}