none
Powershell, Cerberus FTP and SOAP RRS feed

  • Question

  • Hi.

    I have the mere basic skills when it comes to Powershell, but I find it very usefull and want to learn more.

    I wanted to create a script that can create a (or several) new user(s) to Cerberus FTP server, but Cerberus FTP server hasn't created a module for Powershell as of yet (I don't know if thet are planning to do so). But they have made it possible to do with an SOAP request.

    I haven't been able to find an easy to read and understand guide on this. The WSDL fil looks like this:

    (...)

    </operation> <operation name="AddUser"> <documentation>Service definition of function tns__AddUser</documentation> <input message="tns:AddUserRequestMessage"/> <output message="tns:AddUserResponseMessage"/> </operation>

    (...)

    There is much more to the wsdl file, but the box has a 60000 character limit ;)
    I would be more that happy to provide the rest of the wsdl file

    What I have in my head is like this for the import: 

    $URL =  'http://[NameOfFTPServer]:10001/wsdl/cerberus.wsdl'
    $Adm = 'Administrator'
    
    $user = '[UserName]'
    
    $Proxy = New-WebServiceProxy -Uri $URL -Credential $Adm

    And to "cast" the request is were I am in the blind and I was hoping that you guys could help me out :)

    Thank you in Advance

    /L


    • Edited by LooZypher Friday, January 29, 2016 2:23 PM
    Friday, January 29, 2016 2:22 PM

Answers

  • Adapted from Cerberus' "WCF SOAP Client Example" that can be found on this page. Mind, that I've no access to real Cerberus FTP server service, so I can't test this code.

    # Replace Uri with your service Url
    $CerberusFtpSvc = New-WebServiceProxy -Uri 'https://www.cerberusftp.com/files/wsdl/Cerberus.wsdl' -Class CerberusFtp -Namespace CerberusFtp
    
    $AddUserRequest = New-Object -TypeName CerberusFtp.AddUserRequest
    
    # Cerberus FTP server admin credentials
    $Credentials = New-Object -TypeName CerberusFtp.Credentials
    $Credentials.user = 'admin'
    $Credentials.password = 'admin'
    $AddUserRequest.credentials = $Credentials
    
    # New FTP user object
    $User = New-Object -TypeName CerberusFtp.User
    $User.Name = 'soap_test_user'
    
    # New FTP user password object
    $User.password = New-Object -TypeName CerberusFtp.Password
    $User.password.lastChange = Get-Date
    $User.password.noExpire = $false
    $User.password.type = [CerberusFtp.PasswordType]::plain
    $User.password.value = 'P@ssword1'
    
    # New FTP user group object
    $User.groupList = @(New-Object -TypeName CerberusFtp.groupMember)
    $User.groupList[0].name = 'soap_test_group'
    
    # Assign new FTP user object to AddUserRequest object's User property
    $AddUserRequest.User = $User
    
    # Make request
    $Responce = $CerberusFtpSvc.AddUser($AddUserRequest)
    
    #Show responce
    $Responce
    
    #Dispose service object
    $CerberusFtpSvc.Dispose()


    Monday, February 15, 2016 5:33 PM
  • Port referenced on Cereberus page is wrong. Local admin/wsdl port is 10001 not 10000

    The posted converted example will work against Cereberus test server so you can run it as converted.

    Be sure the test group exists or you will get an error.

    The server may not be set for HTTPS on port 10001.  Use HTTP


    \_(ツ)_/

    Monday, February 15, 2016 6:52 PM
    Moderator

All replies

  • See vendor for documentation.

    Generally-

    $proxy.AddUser(<args>)


    \_(ツ)_/

    Friday, January 29, 2016 4:37 PM
    Moderator
  • Hi L,

    Thanks for your post. However, as this issue is much more related to the vendor, I would suggest you to check with vendor if they provide any powershell way to manange their Cerberus FTP server, otherwise I would suggest you to use the GUI to manage it.

    Best Regards,

    Elaine


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, February 1, 2016 3:20 AM
    Moderator
  • Thank you all.

    I'll contact Cerberus :-)
    Monday, February 15, 2016 4:42 PM
  • Adapted from Cerberus' "WCF SOAP Client Example" that can be found on this page. Mind, that I've no access to real Cerberus FTP server service, so I can't test this code.

    # Replace Uri with your service Url
    $CerberusFtpSvc = New-WebServiceProxy -Uri 'https://www.cerberusftp.com/files/wsdl/Cerberus.wsdl' -Class CerberusFtp -Namespace CerberusFtp
    
    $AddUserRequest = New-Object -TypeName CerberusFtp.AddUserRequest
    
    # Cerberus FTP server admin credentials
    $Credentials = New-Object -TypeName CerberusFtp.Credentials
    $Credentials.user = 'admin'
    $Credentials.password = 'admin'
    $AddUserRequest.credentials = $Credentials
    
    # New FTP user object
    $User = New-Object -TypeName CerberusFtp.User
    $User.Name = 'soap_test_user'
    
    # New FTP user password object
    $User.password = New-Object -TypeName CerberusFtp.Password
    $User.password.lastChange = Get-Date
    $User.password.noExpire = $false
    $User.password.type = [CerberusFtp.PasswordType]::plain
    $User.password.value = 'P@ssword1'
    
    # New FTP user group object
    $User.groupList = @(New-Object -TypeName CerberusFtp.groupMember)
    $User.groupList[0].name = 'soap_test_group'
    
    # Assign new FTP user object to AddUserRequest object's User property
    $AddUserRequest.User = $User
    
    # Make request
    $Responce = $CerberusFtpSvc.AddUser($AddUserRequest)
    
    #Show responce
    $Responce
    
    #Dispose service object
    $CerberusFtpSvc.Dispose()


    Monday, February 15, 2016 5:33 PM
  • Port referenced on Cereberus page is wrong. Local admin/wsdl port is 10001 not 10000

    The posted converted example will work against Cereberus test server so you can run it as converted.

    Be sure the test group exists or you will get an error.

    The server may not be set for HTTPS on port 10001.  Use HTTP


    \_(ツ)_/

    Monday, February 15, 2016 6:52 PM
    Moderator
  • Here is the link to the online WSDL.

    https://www.cerberusftp.com/files/wsdl/Cerberus.wsdl

    You must set compatibility in the latest version of IE or you will get a bad transform intended for non-IE browsers.


    \_(ツ)_/

    Monday, February 15, 2016 7:36 PM
    Moderator