I am running a command to get the equivalent display name of an Azure Enterprise Application Object ID however it is not working. Below is the powershell script that I am using.
$caller.caller = (Get-AzADApplication -ObjectId $caller.caller).DisplayName
Thank you in advance for the help.
This is where I am getting the data to be converted to its display name
I tried to reproduce the same in my environment and it's working fine
Please use the below command to get enterprise application display name.
(Get-AzADServicePrincipal -ObjectId 279d67ab-fa63-461a-*********).DisplayName
Output:
Related
I need to change a setting in Azure to allow for Email Verification. MS documentation states that I have to get into azure's powershell and run Set-MsolCompanySettings -AllowEmailVerifiedUsers. I found this, however, to be apparently impossible?
In order to do this, I have to use before: Connect-MsolService, which gives me this error:
Connect-MsolService: Could not load file or assembly
'System.IdentityModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'. The system cannot find the file
specified.
And from what I read, Azure's Powershell does not allow for this?? How am I supposed to run that command?
Thanks in advance, any clue is welcome at this point
We have did a repro in our local environment, below statements are based on the repro analysis.
I have tried connecting to msolservice & successfully enabled the company setting " AllowEmailVerifiedUsers" in my local machine that is running with PowerShell version 5.1
Set-MsolCompanySettings -AllowEmailVerifiedUsers $true
Here is the output
I have tried running the same company setting cmdlet in PowerShell core version 7 it is failing with same error that you have mentioned above.
Based on this GitHub , we understood that currently MSOnline module version v1 is too old and it is not supported in PowerShell core 7.
We would suggest you use the PowerShell version 5.1 to enable company setting using MsolOnline module.
I need to get details of specific azure command(like create VM,remove VM and others) in power-shell.
for example to create VM we have "New-AzVM" command in power-shell.
I would like to know how we can get more help related to that command like
What are different types of arguments we can pass(like Authentication Arguments,Network Arguments and others)?
Which arguments are Required(Mandatory)?
I know we can accomplish same thing in azure-CLI using "az vm create --help" command.
Is there any command in power-shell which gives details of specific commands?(because I don't want to remember command(s) instead of that I would like to use "help" of powershell to get that command)
Note:- There is " Get-Command New-AzVM" command in powershell. but it list all command start with "New-AzVM".
You are looking for the Get-Help cmdlet.
If you add the -ShowWindow switch, you will get a nice output in a new window:
Get-Help New-AzVM -ShowWindow
Output:
The MS docs for the AZ module are pretty great as well. Plenty of examples and more detailed explanations of how things work. See the reference section in the left nav.
On windows, I can use runas to run an application as another account (not the one your are logged in at the moment) like this:
runas /netonly /user:some_domain\account "utility.exe"
How can I get this some_domain\account from PowerShell? I've checked Get-Process and win32_process WMI class but didn't find anything useful.
Update
Re #briantist's answer:
I'm a little confused about the result from #briantist's answer. I logged on to my computer using a local account (my computer is not in a domain) and runas the utility (SQL Server management studio aka SSMS here) as a domain account. When I run the script that #briantist provided, the result just shows me that SSMS is running on my local account not the domain account. But in SSMS I can use a function suser_sname() to ask the server who am i and the result is some_domain\account. It's a little weird to me. Is this by design or am I wrong some where?
Get-process has an -IncludeUserName switch:
get-process -IncludeUserName
Specifically for utility.exe:
get-process utility -IncludeUserName
Tony Hinkle's answer (+1) is great, and very simple, but it does require elevation.
To do this as a non-privileged user, you can use CIM:
Get-CimInstance Win32_Process -Filter "name='utility.exe'" | Invoke-CimMethod -MethodName GetOwner
If you can elevate, I do recommend the other answer.
I am writing a script to deploy my solution which has some "Site" scoped features. In my script I am trying to get hold of Site Collection first like
$SiteCollection=Get-SPSite http://<server>/mysite
When I check SiteCollection -ne $null it always returns null but the same cmdlet works fine at command prompt.
Do not know whats wrong with my script.
This could be a permissions issue. When run from the command prompt, you have permission to get the Sharepoint site. Investigate how you're running your script when it doesn't work. Make sure the user has permission.
I just typed the follow to try and get my SharePoint site:
$spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp"
It gave me the following error
The term 'Get-SPWeb' is not recognized as the name of a cmdlet,
function, script...
The url is correct so why am I getting this error?
I think this need to be run from the Management Shell rather than the console, it sounds like the module isn't being imported into the Powershell console. You can add the module by running:
Add-PSSnapin Microsoft.Sharepoint.Powershell
in the Powershell console.
Run this script from SharePoint 2010 Management Shell as Administrator.
Instead of Windows PowerShell, find the item in the Start Menu called SharePoint 2013 Management Shell: