Power Shell
25 TopicsWarning PowerShell ID 300
HI. Warning PowerShell ID 300 - Device not ready occurs at every startor starting W.P.S 5.1. - <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> - <System> <Provider Name="PowerShell" /> <EventID Qualifiers="0">300</EventID> <Version>0</Version> <Level>3</Level> <Task>3</Task> <Opcode>0</Opcode> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2023-02-09T13:24:44.9356909Z" /> <EventRecordID>657</EventRecordID> <Correlation /> <Execution ProcessID="7524" ThreadID="0" /> <Channel>Windows PowerShell</Channel> <Computer>Windows-11</Computer> <Security /> </System> - <EventData> <Data>Dispositivo non pronto.</Data> <Data>ProviderName=Microsoft.PowerShell.Core\FileSystem ExceptionClass=IOException ErrorCategory= ErrorId= ErrorMessage=Dispositivo non pronto. Severity=Warning SequenceNumber=13 HostName=ConsoleHost HostVersion=5.1.22621.963 HostId=f904787d-5901-4255-b784-310a76225a8b HostApplication=powershell.exe -ExecutionPolicy Restricted -Command Write-Host 'Final result: 1'; EngineVersion= RunspaceId= PipelineId= CommandName= CommandType= ScriptName= CommandPath= CommandLine=</Data> </EventData> </Event> and the following warning appears: And if I open the link I get version 7 which I already have installed. Is there a solution to avoid this warning? Thank youSolved4.8KViews0likes13CommentsUnable to Execute PowerShell Script Commands in Microsoft Teams Session Established via Script
I encountered an issue while attempting to execute PowerShell script commands within a Microsoft Teams session established via a script. The script includes commands to connect to Microsoft Teams using the Connect-MicrosoftTeams cmdlet and subsequently execute other Teams-related commands. While the script executes without errors, the session does not seem to be fully established, resulting in the following error when attempting to execute subsequent commands: powershell : Get-CsTeamsClientConfiguration : Session is not established, run Connect-MicrosoftTeams before requesting access token At line:1 char:1 + powershell -File 'C:\Users\***********************\script.p ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Get-CsTeamsClie...ng access token:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError At C:\Users\****************************\script.ps1:8 char:1 + Get-CsTeamsClientConfiguration + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-CsTeamsClientConfiguration], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsTeamsClientCon figuration This issue is inconsistent, as the commands execute successfully when executed manually. Additionally, I've attempted to introduce delays in the script to allow for the session to fully establish, but the issue persists. This issue impacts the ability to automate tasks in Microsoft Teams using PowerShell scripts. Please let me know if there are any additional steps or information needed to address this issue effectively.1KViews0likes2CommentsLicenseType parameter when you scale your Azure SQL Managed Instance
When you try to scale your Azure SQL Managed Instance and you face the following error message: "Configured pricing tier and vCore values require greater number of licenses than previous instance configuration. Please submit operation again with specified value for licenseType property." you have to review your License type.1.6KViews0likes0CommentsPowershell script to find out Teams policies by users
Hey everyone, do you know if there is a way to run a script to find what Teams policies are assigned to what user? We have a private channel policy in place- I would like to find out a list of users that policy is assigned to. Also, if you delete a user from a custom policy does that user get the default policy? Thanks!106KViews2likes16CommentsGetting all virtual machines in a Hyper-V cluster using Python and WinRM
Hello, I am trying to use Python and WinRM to retrieve a list of all virtual machines in a Hyper-V cluster. I have a PowerShell script that works to retrieve the virtual machines owned by the current node, but I am having trouble modifying it to retrieve all virtual machines in the cluster. Here's the current script that retrieves the virtual machines owned by the current node: # Create a PowerShell session on the host machine session = winrm.Session(host, auth=(username, password),transport='ntlm') # Define the PowerShell command to retrieve the list of virtual machines in the cluster ps_script = """ $nodes = Get-ClusterNode Write-Output $nodes $vm_list = Get-ClusterGroup -Cluster $env:computername | Where-Object {$_.GroupType -eq 'VirtualMachine' -and $_.OwnerNode.Name -in $nodes.Name} | Get-VM $vm_names = $vm_list.Name Write-Output $vm_names """ # Execute the PowerShell command and retrieve the output result = session.run_ps(ps_script) if result.status_code == 0: # Parse the output to get the list of virtual machines vm_info = result.std_out.decode('utf-8').strip() # Print the list of virtual machines print(vm_info) else: # Print the full error message print("Error message: " + result.std_err.decode('utf-8').strip()) Can anyone help me modify this script to retrieve all virtual machines in the cluster, regardless of which node owns them? Thank you in advance for your help!2.1KViews0likes2CommentsHow to add a new set of key & values in json file.
Problem Statement: I want to add a set of new key & value in existing parsed Jsonafter specific index. or position. For example:I have imported Jsonin $Jsonvariable and then I wanted to add new sets of property right after property name 'Service1'. I able to make the script working out for me. However, not able to add new sets of key & value or property after specific position in file. PowerShell Code: function Get-EnvironmentManifest([string]$Filename) { $Settings = Get-Content -Path $Filename -Encoding UTF8 | ConvertFrom-Json -ErrorAction STOP return $Settings } if (([System.Net.Dns]::GetHostByName($env:computerName)).HostName.Split('.')[0] -notmatch "UAT*") { $EnvironmentString = (([System.Net.Dns]::GetHostByName($env:computerName)).HostName.Split('.')[0].Split('-')[1]).ToUpper() for ($i = 1; $i -lt 5; $i++) { $ServiceName = 'Service' + [char](65 + $i) $HastTable = [ordered] @{"Name" = "Service1"; "ProfileType" = "Windows"; "ServiceName" = "$ServiceName";} $Settings = Get-EnvironmentManifest -Filename $TargetJSON $Asset = New-Object -TypeName PSObject $Asset | Add-Member -NotePropertyMembers $HastTable -TypeName 'Asset' $Settings.Profiles.Services += $Asset $Settings | ConvertTo-Json -Depth 3| Set-Content -Path $TargetJSON } } I Was Able toCreate Following JSON Using Above PowerShell Code: { "Environment": {}, "Profiles": { "Services": [ { "Name": "A" }, { "Name": "B" }, { "Name": "C" }, { "Name": "D" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceA" }, { "Name": "E" }, { "Name": "F" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceB" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceC" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceD" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceE" } ] } } But I Want toHave Following Json: { "Environment": {}, "Profiles": { "Services": [ { "Name": "A" }, { "Name": "B" }, { "Name": "C" }, { "Name": "D" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceA" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceB" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceC" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceD" }, { "Name": "Service1", "ProfileType": "Windows", "ServiceName": "ServiceE" }, { "Name": "E" }, { "Name": "F" } ] } }Solved28KViews0likes3CommentsGet-CSOnlineUser command incorrect output
Hi, We are working in a migration from Skype onprem to Teams. We check an user with the command "Get-CSOnlineUser", in Teams the user seems to be correctly provisioned, but the output of the command is not correct. Which is the problem? I send attached the output command. Thank you!! David LozanoSolved1.7KViews0likes3CommentsCreating Powerplans
Hello, I want to create a script using Powershell to set a default power plan. I already found something for the good old CMD but nothing yet for Powershell, so maybe you guys can help?! The Settings: Powerbutton: When I press Powerbutton: Shutdown - Shutdown When I press Sleepbutton: Nothing - Nothing When i close the lid: -Nothing -nothing Plan-Settings: Turn off Display: 15min - never Put it to sleep: Never - Never I would appreciate if you could give me some advice on how to use Powershell creating "Power-Plans". Greetings YannikSchulzSolved7.3KViews1like7CommentsProject Online ReST API create project Error 500
Hello Everyone, When I try to execute create project PowerShell script through .Net application, it throws 500 internal server error. I'm using code samples available here: https://github.com/OfficeDev/Project-Samples/tree/master/O365-Project-Online-REST-Samples Thanks & Regards, Rohan734Views0likes1Comment