snappin doesn't work



  • Server
    • FOG Version: 1.3.4
    • OS: centos6.8
    Client
    • Service Version:
    • OS: win10
    Description

    Hello
    Snappin doesn’t work
    Here is the log file:

    -----------------------------------------------------------------------------
    --------------------------------HostnameChanger-------------------------------
    ------------------------------------------------------------------------------
     09/02/2017 11:47 Client-Info Client Version: 0.11.9
     09/02/2017 11:47 Client-Info Client OS:      Windows
     09/02/2017 11:47 Client-Info Server Version: 1.3.4
     09/02/2017 11:47 Middleware::Response Success
     09/02/2017 11:47 HostnameChanger Checking Product Key Activation
     09/02/2017 11:47 HostnameChanger Already activated with correct key
     09/02/2017 11:47 HostnameChanger Checking Hostname
     09/02/2017 11:47 HostnameChanger Hostname is correct
    ------------------------------------------------------------------------------
    
    
    ------------------------------------------------------------------------------
    ---------------------------------SnapinClient---------------------------------
    ------------------------------------------------------------------------------
     09/02/2017 11:47 Client-Info Client Version: 0.11.9
     09/02/2017 11:47 Client-Info Client OS:      Windows
     09/02/2017 11:47 Client-Info Server Version: 1.3.4
     09/02/2017 11:47 Middleware::Response Success
     09/02/2017 11:47 SnapinClient Snapin Found:
     09/02/2017 11:47 SnapinClient     ID: 5755
     09/02/2017 11:47 SnapinClient     Name: test_arnaud3
     09/02/2017 11:47 SnapinClient     Created: 2017-02-09 11:39:24
     09/02/2017 11:47 SnapinClient     Action: 
     09/02/2017 11:47 SnapinClient     Pack: False
     09/02/2017 11:47 SnapinClient     Hide: False
     09/02/2017 11:47 SnapinClient     Server: 
     09/02/2017 11:47 SnapinClient     TimeOut: 0
     09/02/2017 11:47 SnapinClient     RunWith: powershell.exe
     09/02/2017 11:47 SnapinClient     RunWithArgs: -ExecutionPolicy allsigned -File
     09/02/2017 11:47 SnapinClient     Args: -programme "P:\packages\audio video\vlc\inst_vlc.bat"
     09/02/2017 11:47 SnapinClient     File: -ExecutionPolicy allsigned -File
     09/02/2017 11:47 Middleware::Communication Download: http://coconus.istic.univ-rennes1.fr/fog/service/snapins.file.php?mac=52:54:00:CE:A1:DD||00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0&taskid=5755
     09/02/2017 11:47 SnapinClient C:\Program Files (x86)\FOG\tmp\fog_inst_office2010.ps1
     09/02/2017 11:47 Bus {
      "self": true,
      "channel": "Notification",
      "data": "{\r\n  \"title\": \"Installation de test_arnaud3\",\r\n  \"message\": \"Ne pas éteindre l'ordinateur tant que la tâche n'est pas terminée\"\r\n}"
    }
     09/02/2017 11:47 Bus Emmiting message on channel: Notification
     09/02/2017 11:47 SnapinClient Starting snapin...
    

    I checked powershell.exe -ExecutionPolicy allsigned -File -ExecutionPolicy allsigned -File “P:\packages\audio video\vlc\inst_vlc.bat” on the client it works.

    Where could I find the error ?



  • @Joe-Schmitt ght.
    I changed the user account joined to fogservice and it works now.
    Install is now the user account used by fogservice

    Thanks



  • Here is the power shell code.
    We have no domain

    param (
        [String] $programme
    )
    $user = "install"
    $pwd = "1234500000000000000000000000000000000000000000000000000000AAAA="
    $serveur = "\\fileserver.istic.univ-rennes1.fr\partage"
    $cert = $(Get-ChildItem cert:\CurrentUser\TrustedPublisher | where {$_.Subject -eq "CN=ISTIC/ESIR Signature"})
    $tab_key = @()
    foreach ($i in $cert.SerialNumber.ToCharArray()){$tab_key += [convert]::ToInt16($i,16)}
    $password = ConvertTo-SecureString -key $tab_key -string $pwd
    $credential = New-Object -TypeName system.management.Automation.PSCredential -ArgumentList $user, $password
    
    #net use p: $dossier_partage /p:n /u:$($credential.GetNetworkCredential().username) $($credential.GetNetworkCredential().password)
    if (!(Test-Path -Path p:)){
        $net = new-object -ComObject WScript.Network
        $net.MapNetworkDrive("p:", $serveur, $false, $credential.GetNetworkCredential().UserName,$credential.GetNetworkCredential().password)
    }
    
    #lorsque l'on lance un script powershell, si il y avait des espaces dans le nom, cela ne passait pas 
    #lorsque l'on faisait un start-process et ce nom en argument. Donc on utilise plutot le nom court
    $prog_court = (New-Object -ComObject Scripting.FileSystemObject).GetFile($programme).ShortPath
    					
        write-host "$(hostname):Dossier de l'installer $($dossier_installer)"
    	write-host ""
    	write-host "$(hostname):lancement de $($programme)"
        write-host "$(hostname):lancement de $($prog_court)"
    
    #start-process -FilePath $programme -wait -NoNewWindow
    $dossier_installer = $((get-item -path $programme).DirectoryName)
    
    if (!(Test-Path -Path "$dossier_installer\logs_fog_install")){New-Item -ItemType directory -Path "$dossier_installer\logs_fog_install"}
    $extension = (get-item -path $programme).Extension
    if ($extension -eq ".bat" -or $extension -eq ".cmd") {
    	#write-host "$env:COMPUTERNAME:C'est un script bat"
    	start-process -FilePath $prog_court -wait -NoNewWindow -RedirectStandardOutput ${dossier_installer}\logs_fog_install\${env:COMPUTERNAME}_log.txt -RedirectStandardError ${dossier_installer}\logs_fog_install\${env:COMPUTERNAME}_error.txt
    }
    if ($extension -eq ".ps1") {
    	#write-host "$env:COMPUTERNAME:C'est un script powershell"
    	$policy = Get-ExecutionPolicy
    	Set-ExecutionPolicy AllSigned
    	start-process -FilePath PowerShell -Arg $prog_court -wait -NoNewWindow -RedirectStandardOutput ${dossier_installer}\logs_fog_install\${env:COMPUTERNAME}_log.txt -RedirectStandardError ${dossier_installer}\logs_fog_install\${env:COMPUTERNAME}_error.txt
    	Set-ExecutionPolicy $policy
    }
    
    #net use p: /delete
    $net.RemoveNetworkDrive("p:")
    
    # SIG # Begin signature block
    # MIIECAYJKoZIhvcNAQcCoIID+TCCA/UCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
    # gjcCAQSgWzBZM888888888888888888888888888888888888888sITrck0sYpfvNR
    # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUtCNKzTzpJy5lu9elxjbUrgg6
    # IN6gggIiMIICHjCCAYugAwIBAgIQ1lzBhsDQvaJIVRttke8WMjAJBgUrDgMCHQUA
    # MBwxGjAYBgNVBA0000000000000000000000000000000MDEyMDE0NDkzMloX
    # DTM5MTIzMTIzNTk1OVowHzEdMBsGA1UEAxMUSVNUSUMvRVNJUiBTaWduYXR1cmUw
    # gZ8wDQY555555555555555555555555555555555555555555555555555555eWWBCfR
    # uEdEBxWynlykfLTyteMRiJO3TywGgvhoGX0V+hZpUBeqQLD7q3Qs0npuhWr9COSt
    Insert Code Here
    

  • Moderator

    @Joe-Schmitt he’s using the powershell script to mount & then call another script. But yes, how it’s being done matters and we need to know.

    @lebrun78 said in snappin doesn't work:

    hello
    -programme is an option of the script fog_inst_office2010.ps1

    fog_inst_office2010.ps1 is a script to mount p: with authentication and call a bat script


  • Senior Developer

    @lebrun78 snapins run as SYSTEM (this is like a limited root on unix). If a script works when run manually but not as a snapin, then your script is not SYSTEM compliant. Usually its an issue when someone tries to use network shares, which it appears you are doing. SYSTEM is an non domain user, so if your network share requires someone to be domained user to access it, that’s one potential issue. Ultimately this is a network share issue, and without see exactly how you are mounting / using it, we cannot help.



  • here is this extract of windows powershell log in windows events viewer
    1st run by snap in:
    alt text

    2nd by manual command line that works:
    alt text

    I don’t understand !

    Witch trigger mark snapin task ended in web console ?



  • fog_inst_office2010.ps1 is a script to mount p: with authentication and call a bat script


  • Senior Developer

    So what is the point of the fog_instoffice2010.ps1 file?



  • @Tom-Elliott
    No because it was not working with office2010, I try it with a script to install videolan player which is very lighter



  • Should it be a path problem ? Should fog client install the script from c:\program file x86\fog\tmp ?


  • Senior Developer

    @lebrun78 Well, if it’s “installing MS Office, as the file kind of suggests” I’m guessing the PS1 has to either download the installer files and/or start the installer files across a network share. Are you setting the installation in a “silent” mode? Does running it manually on the command line cause you to do user inputs or not?



  • @Tom-Elliott
    I manually restart it while the task is still marked as running


  • Senior Developer

    @lebrun78 It’s not verbosity that will get you an answer.

    Can you actually upload the ps1 script here? From what I can see your client is restarting after a period of time.

    It get’s the point of displaying the Snapin, the client appears to restart, then it get’s back to the same point and ends on “Snapin starting”.

    This leads me to think there’s something in the snapin causing issues. Maybe from the PS1 script?



  • could I make log more verbose ?



  • @Wayne-Workman
    that’s what I did, I think ?
    alt text


  • Moderator

    @lebrun78 There is a Powershell template. Pick the template, upload the powershell file. That’s all you have to do when creating a snapin.



  • @lebrun78
    Powershell has it’s own environment and for this reason, I compiled ps1 to exe to avoid path problem for an old project.

    My script just updated the background on the Windows 7 lock screen.

    Sorry.



  • @Zaarin
    Fog client is running in his folder, isn’t it ?



  • This line works, correct:

    powershell -ExecutionPolicy allsigned -File “C:\Program Files (x86)\FOG\tmp\fog_inst_office2010.ps1” -programme “P:\packages\audio video\vlc\inst_vlc.bat”

    Not this one:

    powershell -ExecutionPolicy allsigned -File “fog_inst_office2010.ps1” -programme “P:\packages\audio video\vlc\inst_vlc.bat”

    Because powershell is executed from another folder.

    The question is: which version is run by the snapin?

    An easy workaround is to compile ps1 into an exe.



  • @Tom-Elliott said in snappin doesn't work:

    powershell -ExecutionPolicy allsigned -File “C:\Program Files (x86)\FOG\tmp\fog_inst_office2010.ps1” -programme “P:\packages\audio video\vlc\inst_vlc.bat”

    On the machine, when I run this command , it runs, fog_inst_office2010.ps1 is download and placed in “C:\Program Files (x86)\FOG\tmp” by fog snap in install


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.