Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Hi,
I created kind type of command to stop remote SQL service that worked fine in wfa 2.01
$MachineName = 'gdc01172'
$Instance = 'SGEDYNT1'
$Service = 'MSSQL$'+$Instance
(get-service -ComputerName $MachineName -Name $Service).stop()
It works fine in PS debugger, however in WFA 2.1 $Service is viewed as null and workflow crash with error
***in Powershell_ISE
PS C:\Users\itsfe> $MachineName = 'gdc01172'
$Instance = 'SGEDYNT1'
$Service = 'MSSQL$'+$Instance
(get-service -ComputerName $MachineName -Name $Service)
Status Name DisplayName
------ ---- -----------
Running MSSQL$SGEDYNT1 SQL Server (SGEDYNT1)
**in WFA
16:37:51.779 INFO [_start_stop_SQL] Error: You cannot call a method on a null-valued expression.
Is somebody experience the same with $ char or is $ is treated differently from 2.1 version?
Help appreciated
francois
Solved! See The Solution
francois,
I don't think there has been any change with this regard since WFA2.0.1.
I tried a similar but not the exact scenario on WFA 2.1 and I didn't face any problems
I created a dummy windows service with name NA_WFA_$DB on my WFA server and used a command to call the following.
On powershell I was getting this:
PS C:\Users\Administrator> Get-Service -ComputerName localhost -Name 'NA_WFA_$DB'
Status Name DisplayName
------ ---- -----------
Stopped NA_WFA_$DB NA_WFA_$DB
PS C:\Users\Administrator>
-----
On WFA command, I added a snippet
-----
part1='DB'
part2='NA_WFA_$' + part1
$Service_name= 'sinhaa' + (Get-Service -ComputerName localhost -Name $part2).Name
-----
This passed in execution for me. $Service_name gave sinhaaNA_WFA_$DB
This means even with the presence of $ in the Name, my execution was successful and it didn't return a null object.
Are you still facing the issue?
francois,
I don't think there has been any change with this regard since WFA2.0.1.
I tried a similar but not the exact scenario on WFA 2.1 and I didn't face any problems
I created a dummy windows service with name NA_WFA_$DB on my WFA server and used a command to call the following.
On powershell I was getting this:
PS C:\Users\Administrator> Get-Service -ComputerName localhost -Name 'NA_WFA_$DB'
Status Name DisplayName
------ ---- -----------
Stopped NA_WFA_$DB NA_WFA_$DB
PS C:\Users\Administrator>
-----
On WFA command, I added a snippet
-----
part1='DB'
part2='NA_WFA_$' + part1
$Service_name= 'sinhaa' + (Get-Service -ComputerName localhost -Name $part2).Name
-----
This passed in execution for me. $Service_name gave sinhaaNA_WFA_$DB
This means even with the presence of $ in the Name, my execution was successful and it didn't return a null object.
Are you still facing the issue?
I retried and that worked now, I don't know what is spent.
My service SQL is successfully stopped with service name.