Search found 15 matches

by drpiet
Fri Jul 27, 2018 11:18 am
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

I appreciate your help, but there is absolutely nothing to try. This is not based on assumptions, just powershell knowledge.
Thanks
by drpiet
Fri Jul 27, 2018 10:12 am
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

Don't take me wrong, I appreciate your answers and your time.
But the code you posted the only thing that does different is running the command inside a try/catch structure, so I know that will not change the result. For sure is a better way to code, but is not what I'm looking for right now.
by drpiet
Fri Jul 27, 2018 6:04 am
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

The exact code is on the original post, that is what I'm running.
And I'm running it on the prompt.
by drpiet
Wed Jul 18, 2018 6:02 am
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

I would do it like this to hedge against errors. $path = '.\profile.json' $deploy = { Param ( $path, $ResourceGroup, $VMName ) Try{ Import-AzureRmContext -Path $path -ErrorAction Stop | out-null Get-AzureRMVm -ErrorAction Stop| where{ $_.ResourceGroupName -eq $ResourceGroup -and $_.name -eq $vmname...
by drpiet
Mon Jul 16, 2018 12:18 pm
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

It is just one object. I'm running a get-azurermvm and I'm passing resourcegroup and VM name as parameter, so there is no way to return to return multiple objects. Besides that, we are talking about exactly the same command, against the same environment. The only difference is: the first case is "in...
by drpiet
Mon Jul 16, 2018 12:02 pm
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

I'm not using quotes on my code, I used them to show you what I meant by expanding properties.
The point of this entire thing is, this code:

Code: Select all

$MyVariable.NetworkProfile
return one value when the command is run directly and a different value when ran as a job (exactly the same code).
by drpiet
Mon Jul 16, 2018 7:33 am
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Re: Different results on a command run as job and regularly

By saving the result of the command on a variable, I would be able to query for example "$MyVariable.NetworkProfile", which will return the ID of the network interface and if I keep digging I might get some more information. When the same command is ran as job, I will not be able to query (following...
by drpiet
Fri Jul 13, 2018 12:55 pm
Forum: Windows PowerShell
Topic: Different results on a command run as job and regularly
Replies: 20
Views: 1547

Different results on a command run as job and regularly

Hello everybody. This is about running an "azure command" as a background job. I've been dealing with this for a week already. If I run this command: Get-AzureRMVm | where{($_.ResourceGroupName -eq $ResourceGroup) -and ($_.name -eq $vmname)} -ErrorAction Stop Everything works just fine, I receive th...
by drpiet
Fri Jun 01, 2018 1:00 pm
Forum: PowerShell GUIs
Topic: Form freeze when running 'get-azurermvm'
Replies: 11
Views: 1137

Re: Form freeze when running 'get-azurermvm'

Did you apply my suggestions? Your code can create conflicts in some situations and youmust be running the latest version of the Azure modules. (get-module AzureRM.Compute).Version Major Minor Build Revision ----- ----- ----- -------- 5 0 0 -1 Hi, sorry for the delay. I didn't apply any of the sugg...