SnapinClient Return Code :5



  • Hello everybody, @EduardoTSeoane . I have three VMs in my lab; FOG server, Windows 10 client and a File server, I would like to install in client vm a program which is located on the file server using FOG server, and when I’m trying to deploy a script with batch snapin template, it strart runing but it finished with an error message (winodws 10 error code 5 as shown on the log file) which means that an acces denied has been reported.
    log file
    LOG.PNG
    batch file
    batch.PNG



  • Promised Example:

    ## Elevate to admin the current Script Execution
    If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
    {  
    $arguments = "& '" + $myinvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $arguments
    Break
    }
    ##Create credentials
    $password = ConvertTo-SecureString 'MySecretPassword' -AsPlainText -Force
    $user='useradmin'
    $credential = New-Object System.Management.Automation.PSCredential ($user, $password)
    ##Execute wusa.exe with parameters and useradmin credentials.
    Start-Process -FilePath <path wusa.exe> -ArgumentList <arguments for wusa.exe> -Credential $credential -LoadUserProfile -PassThru
    

    This maybe works

    With New-PSDrive you can mount samba and nfs shares if you have the nfs-infrastructure installed.


  • Moderator

    @khalid Another thing to try is to mount the NAS share as a Samba user and then access it using the assigned drive letter.



  • Thank you all, I will try this right now



  • System user has problems with net access, is a local system user.
    And wusa.exe i read that has some remoting problems.

    Try this:

    Use a Powershell Snapin Pack with an installation script and desired packages you want to install as contents.

    Into that Installation Powershell Script you must do.

    1º Elevate the script to Administrator user.
    2º Launch with Admin credentials an Start-Process or Invoke… to execute the installation.
    Maybe it works.

    Now I cant to write an example. I do it later this night.


  • Developer

    @khalid Problem might be that the fog-client runs as System Service. Maybe installing updates like this is not allowed by MS security.


  • Senior Developer


Log in to reply
 

368
Online

5.9k
Users

13.2k
Topics

124.2k
Posts