Subscribe

WFA Powershell Error - Drive not found

While running ps.cmd from WFA windows server we see error "Get-Item: Cannot find drive. "

 

ps.cmd contains,

 

@rem opens a powershell prompt with WFA's commandlets loaded
@PowerShell.exe -NoExit -ExecutionPolicy remotesigned -Command "& {cd (((Get-Item (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NA_WFA_SRV).ImagePath.Split(" ")[0]).Directory.fullname)); ../PoSH/profile.ps1; ((Get-Host).UI.RawUI).WindowTitle = 'WFA PS'; clear}"

 

profile.ps1 contains,

 

$ModulesDir = split-path $MyInvocation.MyCommand.Path
Import-Module $ModulesDir\Modules\WFA
Import-Module $ModulesDir\Modules\WFAWrapper
Import-Module $ModulesDir\Modules\DataONTAP

 

Executing Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NA_WFA_SRV seems to be good.

 

PSPath               : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NA_WFA_SRV
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
PSChildName     : NA_WFA_SRV
PSDrive               : HKLM
PSProvider         : Microsoft.PowerShell.Core\Registry
Type                   : 16
Start                   : 2
ErrorControl      : 1
ImagePath        : "E:\Program Files\NetApp\WFA/bin/NA_WFA_SRV.exe" //RS//NA_WFA_SRV
DisplayName     : NetApp WFA Server
DependOnService : {NA_WFA_DB, Tcpip, Afd}
ObjectName      : LocalSystem
Description       : NetApp WFA Application Server running JBoss AS7

 

Kindly find the error screenshot atttached.

Re: WFA Powershell Error - Drive not found

You must be using an old version of WFA, WFA2.1 or older. This is a bug in the WFA2.1 and below versions.

 

Replace the ps.cmd contents with the below code:

----

 


@rem opens a powershell prompt with WFA's commandlets loaded
@PowerShell.exe -NoExit -ExecutionPolicy remotesigned -Command "& {cd (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NA_WFA_SRV).ImagePath.substring(1, $(Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NA_WFA_SRV).ImagePath.length -34); ../PoSH/profile.ps1; ((Get-Host).UI.RawUI).WindowTitle = 'WFA PS'; clear}"

 

----

 

Save the file and now launch ps.cmd.

 

 

sinhaa

 

 

 

 

 

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

Re: WFA Powershell Error - Drive not found

Hi Sinhaa,

Thanks for your recommendations. We made changes to ps.cmd as per your recommendation. It worked, but was not able to run WFA commands eg: " show-WFAConfig -name TransactionTimeout".

It seems like modules are not loaded. Will be cheking it during our next scheduled.

Kindly find the attached error.

 

 

Regards,

Rasik

Re: WFA Powershell Error - Drive not found

[ Edited ]

I already told that you are using a very old version of WFA. I gave you the fix for that. But the cmdlet Show-WfaConfig is not available with that version. Show-WfaConfig is only available from WFA3.0 and above.

 

WIth WFA 3.0 and above the original issue of ps.cmd failing will also not be seen.

 

 

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