Microsoft Virtualization Discussions



Given our environment, I am forced to join CIFS servers to the domain from across a VPN tunnel. I am attempting to use the "Add-NcCIFSServer" cmdlet in a try/catch statement in the event that the user fat fingers a usernamd or password and they can attempt to join the server three times. I have found out that this cmdlet seems to timeout though before the CIFS server is joined to the domain and falls into the catch. When I review the SVM, i see it is actually joined to the domain though. Does anyone have a clever way to pause or wait the the result of the Add-NcCIFSServer cmdlet? I see there is an option for numer of tries, but is that a number of pure attempts before moving on and does it initialize the request all over again?


I thought about using InVoke-NcSsh to attempt a command line creation of the CIFS server, but was wondering if I am missing somethign obvious.


Bottom line, cmdlet times out, but the operation completes successfully. 



Hello @drwoodberry,


I don't think there's a way to do an async call for the API.  Even using Invoke-NcSsh you might run into the same problem if it's waiting for the cli command to return before the cmdlet exits and returns the response back to the PowerShell session.


The number of tries parameter is referring to how many times the PSTK will attempt the ZAPI call before failing...if the call is successful, but times out, that's a different issue.



If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.


I am waiting to test the SSH command to see what happens. 


I am guess there cannot be a timeout switch added to the cmdlet for instances like this is there? Otherwise I was thinking about just executing the command, surpressing the error, waiting for a period of time and checking if the server joined...if not, attempt again. 


So using the Invoke command, it just suspends the script. I am sure it is waiting for the username and password but I am not sure how to pipe that into the Invoke. I will go back to square 1.