Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

I am attempting to use a single element of an array, when creating a string message, but it is using both elements, concatenated by a space, whether I use $myArray[0] or $myArray[1]... # Multiple ...
Todd Powers's user avatar
1 vote
1 answer
76 views

I'm parsing a file using powershell 5.1 and I almost get my goal but I need help in this part. The input file is like this: CODE=MMH4 description=beg somedata - dduik CODE=PPH2 description=beg Area1 -...
Rasec Malkic's user avatar
0 votes
0 answers
30 views

I have a file with some strings like below for which I want to replace the || with newline using powershell 5.1. This is || some test || string I've follow some advices in this thread and I'm trying ...
Rasec Malkic's user avatar
2 votes
2 answers
72 views

I faced a specific behavior while using verbose output in class. This works like a charm: # SomeModule.psm1 class SomeClass { SomeClass() { Write-Verbose "It works!" } } ...
Aleksej Egorov's user avatar
-1 votes
0 answers
59 views

I have a code which map users to group via a resource ad_group_membership from terraform provider hashicorp/ad locals { # --- Загружаем все YAML-файлы --- yaml_be = yamldecode(file(var....
Dmitry Zimin's user avatar
1 vote
1 answer
154 views

$qusertest = quser | Out-String if ([string]::IsNullOrEmpty($qusertest)){ Restart-Computer -Force } else { Write-Output $qusertest; exit 0 } I am testing out code to automatically reboot ...
FoxCode's user avatar
  • 35
1 vote
1 answer
94 views

I'm using a command similar to the one below to copy a file to a directory: copy-item 'C:\\some\\source\\directory\filename.txt' -Destination 'T:\some\destination\dir' C:\ is a local disk. T:\ is a ...
Michael Remijan's user avatar
2 votes
1 answer
114 views

I'm building an script in PowerShell that runs via an RMM tool, so it executes in the SYSTEM context. The goal is to automatically delete files from the Recycle Bin that are older than 30 days, for ...
smurfexe's user avatar
Advice
0 votes
5 replies
93 views

I'm currently writing a helper module and despite my efforts, some private variable have to be accessed read/write from outside the module. my first attempt was using Export-ModuleMember -Variable but ...
Peyre's user avatar
  • 635
4 votes
2 answers
173 views

Consider this example, a script named test.ps1 function MyTestFunction { [CmdletBinding()] param () try { [bool]$functionBool= $null } catch {throw $_} Get-...
Paul π's user avatar
  • 585
0 votes
1 answer
508 views

In my PowerShell scripts I'm using the ActiveDirectory module, which contains the various *-AD* cmdlets such as Get-ADUser. How can I automate (script) the installation of the PowerShell ...
mklement0's user avatar
  • 452k
0 votes
1 answer
58 views

I'm trying to add commands to a powershell script that finds a username and password test and replaces them with the user's name and password. The issue that I'm running into is with special ...
JoeTheSane's user avatar
2 votes
0 answers
77 views

I know you can use the Get-AppxPackage and Get-AppxPackageManifest cmdlets in Powershell to get the package family and it's specific application entry point. In this example with Windows Media Player ...
djsumdog's user avatar
  • 2,828
3 votes
2 answers
99 views

With the below KQL query, I'm extracting accesses to Azure Key Vault secrets and keys in log analytics, by extracting name of the Key Vault resource (kv) and its accessed keys and secrets (sec) from '...
Luc Vanden Elschen's user avatar
3 votes
2 answers
159 views

I am running python 3.13.5 via PowerShell in windows 10. I can successfully run the folowing command, and now want to run it with a python script & 'D:\realesrgan\realesrgan-ncnn-vulkan.exe' -i 'D:...
Christopher Pratt's user avatar
2 votes
2 answers
119 views

Environment Windows 11 23H2 Powershell v5.1 Docker desktop 4.49.0 Issue I have a weird problem when I use variables as arguments for a docker run command inside a Powershell script (.ps1 file). If ...
Damien's user avatar
  • 23
1 vote
0 answers
53 views

I want to delete DHCP Reservations using a Python script and have the following code: import tkinter as tk from tkinter import messagebox import subprocess def delete_reservation(): dhcp_server = ...
Luca's user avatar
  • 11
3 votes
2 answers
108 views

In Python, there are two libraries which are often used in tandem, Poppler and Tesseract. They both need external downloads to function: Poppler, Tesseract. The general recommendation for Windows is ...
user30589464's user avatar
2 votes
2 answers
130 views

Kotlin compiler is located in C:\kotlinc\bin, when trying to run any script that is located in a path with space - it fails with message InvalidPathException: Illegal char <:> at index 2: /H:/My%...
Vadym Borys's user avatar
2 votes
2 answers
99 views

I have a powershell command that I want to execute and direct the verbose output to a text file. Compress-Archive -Path $currentLogDir_TempPathString -DestinationPath $currentLogDir_ArchiveFileName -...
WKNav4997's user avatar
0 votes
2 answers
116 views

Windows 11 Power shell I'm trying to run the following IF statement in power shell - basically to check if a file exists on encrypted drive P, if it doesn't then create the encrypted drive. I get an ...
Cholokom's user avatar
Advice
1 vote
1 replies
97 views

The start menu features a Developer PowerShell for VS 2022 which defaults to x86: PS C:\> (Get-Command link.exe).Source C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14....
Micha Wiedenmann's user avatar
1 vote
0 answers
86 views

I want to retrieve content from web page. However, I tried above method but the error still come when the query string contain Chinese character. code $json = Get-Content -Encoding utf8 -Path "./...
Akira's user avatar
  • 33
0 votes
1 answer
78 views

I have a log folder structure that's similar to this: D:\ + Logs + Prod + API1.domain.com + Server1.domain.com + Server2.domain.com + API2.domain.com + Server1.domain.com ...
WKNav4997's user avatar
5 votes
1 answer
92 views

Passing an environment variable from command line works differently in Powershell v7.5 compared to v5.1. Is there some overall setting for PS 7.5 to provide compatibility? Or an explanation of why ...
macq's user avatar
  • 71
2 votes
3 answers
119 views

I have: $method = "property.childproperty" How can I get to $foo = $object.property.childproperty by using the $method variable?
rhavin's user avatar
  • 1,804
0 votes
0 answers
71 views

I have a powershell script calling dotnet add Script: dotnet add `"$projectFilePath`" package "$packageName" --source "$dorsetIcsSourceName" --version "$...
Dib's user avatar
  • 2,107
1 vote
0 answers
112 views

How to get the completion time of a stage in my upstream pipeline? I read in the documentation that I can use resources.pipeline.<alias>.xyz, but I don't see any predefined variables that allow ...
Carla Lima's user avatar
-2 votes
2 answers
172 views

I'm receiving this date and time in US format from an upstream server I have no control over and can't change: 12/16/2024 11:30:23 AM I am trying to convert it to UK format using PowerShell: [DateTime]...
Joly's user avatar
  • 3,346
Advice
0 votes
1 replies
71 views

I am trying to replicate a combination of WMI and ADSI, to use just WMI. This is a quick fix whilst we put a case forward for winRM as a replacement. This is something that is new to me, so please ...
Nathan_Sav's user avatar
  • 8,576
Advice
1 vote
7 replies
102 views

I have array of strings $Emails = '[email protected]','[email protected]','[email protected]' This array can contain from 1 to unlimited numbers of elements. And I need to build a filter string from ...
Posix's user avatar
  • 23
1 vote
1 answer
96 views

While using .split, if the string contains just "/" (root) and the delimiter is also "/" - the count of the string split is 2, though would have expected 0 Why is this the result? ...
Mr E's user avatar
  • 21
4 votes
1 answer
78 views

I am using a PowerShell script using the module WinSCP to download files from a SFTP server. I am using a file mask so I only download files matching *.zip which have been added today. The SFTP folder ...
OrionUK's user avatar
  • 67
0 votes
1 answer
70 views

I am in the process of building a custom RBAC role, only to delete & restore the App registration and service principals. I can manage delete actions and restore the App registration, but I don't ...
kalyani's user avatar
  • 31
2 votes
0 answers
115 views

I am trying to export Excel files to PDF. Since there are a lot of Excel files to be exported I'm trying to automate this via PowerShell. In principle this works fine, but some Excel files contain ...
uli's user avatar
  • 71
0 votes
0 answers
32 views

I try to implement a SQL automated installation of SQL Server. Currently I hang with SqlServerDsc/SqlPermission. I use a block in my json: { "type": "SqlServerDsc/SqlPermission"...
pixbye's user avatar
  • 157
0 votes
1 answer
72 views

I'm looping through an Azure DevOps query script to essentially create copies of work items into a new iteration. The problem I'm having is with the final Invoke-RestMethod call at the end of the ...
GHarland's user avatar
Tooling
1 vote
5 replies
171 views

I reviewed many suggestions posted, but didn't find an exact match. I've created PS scripts where there is one parent script that runs its functions and then calls upon 25 other subscripts in sequence ...
JeffR's user avatar
  • 3
2 votes
2 answers
187 views

ff I have a function foo, it needs to accept a string, this string can be passed to it directly by typing at the terminal, from a variable or from the clipboard. function foo{ [CmdletBinding()] ...
Ralf_Reddings's user avatar
1 vote
1 answer
119 views

I'm trying to automate the activation of my PIM Entra ID role for Azure Tenant with either Azure CLI or PowerShell. I've followed the answers in Activate PIM role for Azure resources via REST / ...
Daniel M.'s user avatar
  • 305
2 votes
0 answers
74 views

I'm encountering an issue when using GitHub Copilot in VS Code. After Copilot agent modifies a file, it suggests a PowerShell command and asks whether I want it to run the command for me. When I click ...
yuyu fu's user avatar
  • 11
Best practices
1 vote
6 replies
152 views

I'm building a report about SMART metrics (SSD storage wear status): Get-PhysicalDisk | %{ $s = $_ | Get-StorageReliabilityCounter; [PSCustomObject]@{ Model = $_.Model; ...
gavenkoa's user avatar
  • 49.7k
1 vote
1 answer
84 views

How to fix this so that option /FI is detected correctly? This is just an example. $myfilter="foo" $myargs="/FI $myfilter" tasklist $myargs ERROR: Invalid argument/option - '/FI ...
schussda's user avatar
3 votes
2 answers
143 views

In a Powershell script, Mute is performed with: (New-Object -ComObject WScript.Shell).SendKeys([char]173) That works. Windows reference lists constants for each key. Mute constant is VK_VOLUME_MUTE. ...
johny why's user avatar
  • 2,270
0 votes
0 answers
59 views

I am importing a web order CSV file into our in-house database. Usually it's ok but, if the user enters special delivery instructions, the csv file includes the string "help.", followed by ...
Gil Fleming's user avatar
2 votes
1 answer
65 views

Environment Azure DevOps Classic UI Task: PowerShell@2 (Windows PowerShell, not pwsh) Agent: Windows (Microsoft-hosted and self-hosted both repro) PowerShell version: Windows PowerShell 5.1 Script ...
alexis19apl's user avatar
3 votes
1 answer
120 views

I am an occasional casual programmer (for about 60 years now!). I wrote 2 functional SNMP PowerShell desktop shortcut scripts 4 years ago. Now I am writing two scripts for my old Windows 10 system: ...
Webtest's user avatar
  • 53
4 votes
2 answers
132 views

Demonstrate the issue Let's use nvim to create a text file: > nvim C:\temp\in-file.txt The contents of the text file: > Get-Content C:\temp\in-file.txt abc bcd cde Now let's create a simple ...
dharmatech's user avatar
  • 9,719
4 votes
2 answers
129 views

I am using the Teams PowerShell Module 7.3.1 on PowerShell Core 7.5.3 to pause a provisioning script until a newly created user becomes available in the Microsoft Teams PowerShell module, as follows: ...
Minkus's user avatar
  • 552
1 vote
3 answers
245 views

I have a large number of files (about 3800) that I want to run a program over. The program reads a WAV file and makes a short .TSV text file containing the WAV's lip-sync data (but that is by-the-by ...
Benjamin Rich's user avatar

1
2 3 4 5
2386