AnsweredAssumed Answered

Home Drive Folder Creation

Question asked by Hardik Modi on Nov 7, 2018
Latest reply on Nov 7, 2018 by Mostafa Helmy

as part of Joiner workflow, post active directory account creation, we are populating values within homedirectory attribute, and using powershell script to create actual folder for that user, 

 

script that we are using is, 

 

Import-Module ActiveDirectory 2>&1 | Write-Host;
if($?)
{

$homeDir = "\\CORP.INT\HOME\Q\hmodi";
$user = "hmodi";
$domain = "Corp";

New-Item "$homeDir" -type directory;

$acl = Get-Acl "$homeDir";
$permission = "$domain\$user","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow";
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission;

$acl.SetAccessRule($accessRule);

$acl | Set-Acl "$homeDir";
}

 

Above script works within PowerShell utility server, but when we try to execute script within SSH connector, during test connector capability, we are seeing request failed. 

 

we also tried to execute PS script from putty via SSH, and from SSH, we are getting, command not found message or command not recognized. 

 

any pointers on how to execute ps script over SSH. 

 

Outcomes