none
Why does modifications to PSM1 script not show up in ASDK 1.1902.0.69? RRS feed

  • Question

  • C:\CloudDeployment\AzureStackDiagnostics\Microsoft.AzureStack.Diagnostics.DataCollection

    Has a bunch of PSM1 files. When I run the cmdlet Get-AzureStackLog() these psm1 files like 
    Microsoft.AzureStack.Diagnostics.DataCollection.psm1
    InvokeLogCollection.psm1
    CommonHelper.psm1
    etc ... files get called.

    My question is when I put some echo statements in these psm1 files how come they dont get executed? I tried closing power shell and reopening afresh that did not help. I tried regsvr32 /u Microsoft.AzureStack.Diagnostics.DataCollection.dll hoping I need to unload and load this dll but regsvr32 did not work. I tried rebooting that also did not help. I was hoping on reboot the DLL would use the new PSM1 file. I am the only user on the system so the DLL is not used by anyone else. 

    My theory is, there must be a reason for MSFT to share the PSM1 files and the one reason I can think of is for users to custom use it?  Question is how to use it? 

    Any help, idea would be greatly appreciated. Thanks


    Thursday, April 25, 2019 12:05 AM

Answers

  • In PowerShell, Echo can be redirected, which is likely in a log collection script. I would use Write-Host for testing. I tested this myself with Write-Host and I was not able to see it in the logs, but I did not try to reload the DLL. 

    This particular file could be legacy code, or it could be what is executed when this script enters a remote PS Session, so the output is not in the current context. Why exactly do you want to use this psm1? Does the Get-Azurestacklog script not show something that you would like to see?

    Thursday, April 25, 2019 6:33 PM
    Moderator
  • I found the solution. Hooray :) 

    C:\Program Files\WindowsPowerShell\Modules\Microsoft.AzureStack.Diagnostics.DataCollection 

    Also has the copy of all the psm1 files which are under 

    C:\CloudDeployment\AzureStackDiagnostics\Microsoft.AzureStack.Diagnostics.DataCollection

    My guess is one under CloudDeployment is meant for the system to use and one under WindowsPowerShell for users. So I added echo "Hello World" in one of the PSM1 files under WindowsPowerShell started the Powershell fresh and it echoed promptly. So problem solved. I could have deleted the posting but then I thought with more than 30 hits and 18 hours with no solution it is better someone benefit from my discovery. 


    Thursday, April 25, 2019 5:22 PM

All replies

  • I found the solution. Hooray :) 

    C:\Program Files\WindowsPowerShell\Modules\Microsoft.AzureStack.Diagnostics.DataCollection 

    Also has the copy of all the psm1 files which are under 

    C:\CloudDeployment\AzureStackDiagnostics\Microsoft.AzureStack.Diagnostics.DataCollection

    My guess is one under CloudDeployment is meant for the system to use and one under WindowsPowerShell for users. So I added echo "Hello World" in one of the PSM1 files under WindowsPowerShell started the Powershell fresh and it echoed promptly. So problem solved. I could have deleted the posting but then I thought with more than 30 hits and 18 hours with no solution it is better someone benefit from my discovery. 


    Thursday, April 25, 2019 5:22 PM
  • In PowerShell, Echo can be redirected, which is likely in a log collection script. I would use Write-Host for testing. I tested this myself with Write-Host and I was not able to see it in the logs, but I did not try to reload the DLL. 

    This particular file could be legacy code, or it could be what is executed when this script enters a remote PS Session, so the output is not in the current context. Why exactly do you want to use this psm1? Does the Get-Azurestacklog script not show something that you would like to see?

    Thursday, April 25, 2019 6:33 PM
    Moderator
  • Thanks @Trace-Progress

    Later I realized my mistake, yes Write-Host is a better option. Also there is the Trace-Progress() the PSM1 is currently using which works equally well and also it can be used to print out values too. I found Trace-Progress() very useful. 

    Monday, April 29, 2019 6:18 PM