Most voted "powershell" questions
The use of the tag must be related to problems with Microsoft Windows Powershell script programming which is a powerful and modern Windows command "prompt", aimed at automation and maintenance of systems by administrators.
Learn more…102 questions
Sort by count of
-
1
votes1
answer2395
viewsBrowse folders and subfolders with powershell
I recently did a data recovery from a hard drive, but the folder where the files are, is separated by subfolders with the name of each extension (eg: jpg, gif...), and each subfolder contains other…
-
1
votes0
answers223
viewsVB.NET + Powershell
I would like to create a program in VB.NET that runs the following code in Powershell Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register…
-
1
votes1
answer312
viewsPowershell interactive script menu. I can’t quit(invalid option)
I’m a beginner in Powershell and I have a little problem. I have 2 scripts (menu and submenu). I run script_A (menu) and when I select option 9 (Exit) it works as expected. But when I run script_A…
-
1
votes0
answers69
viewsHow to pass a function in an array in the powershell?
I need to create a script, some of the fields are avoidable and I would like to pass a function to edit it but when I pass it inside the array it pops one ERROR.
-
1
votes2
answers137
viewsFind 2 occurrences in powershell
How can I find 2 occurrences together in a determining file using powershell? $p = @("string1","string2") get-content C:\log.txt | Select-String -Pattern $p Above, the expression returns me…
powershellasked 7 years ago DiChrist 4,567 -
1
votes1
answer181
viewsAutomating deploy using Msbuild
I’m creating a bat to compile and publish a Visual Studio project using MSBuild. However, I need to inform a user and password for the MSBuild. What I am doing, is to solitar in the bat the user and…
-
1
votes1
answer27
viewsWindows Powershell Azure Login Error
Data: sdk from Azure downloaded Windows: 10 Error logging into Azure by powershell: How to correct this error ?…
-
1
votes0
answers736
viewsRemove a user from a group in AD using . net + powershell
Hello, I am trying to remove users from a group in AD from a Powershell script, within an Asp.net MVC application. I have a similar script and function to add a user in AD, but the removal of users…
-
1
votes1
answer49
viewsError when identifying user login "-Identity"
I made this simple script to remove a particular group from AD users via .csv but is accusing error that the $_.user has not been identified or is empty. Import-Csv -Path…
powershellasked 5 years, 3 months ago Sandson Costa 509 -
1
votes1
answer214
viewsCopy and Paste in powershell for automation of tasks
How to Copy and Paste in powershell for automation of tasks
powershellasked 5 years, 1 month ago Ruben Borges Ramos 311 -
1
votes0
answers43
viewsSQL and xp_cmdshell
Good people, I have this little code in SQL: DECLARE @StringRTF VARCHAR(MAX), @Posh VARCHAR(8000) SET @StringRTF = (select traduçao from artigos where Cod_Art='01010066') select @StringRTF SET @Posh…
-
1
votes1
answer1434
viewsHow to execute a command in CMD or Powershell, passing the commands via C#?
I need to execute a command on CMD that I pass the parameters via C# for example: "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqldump.exe" --column-statistics=0 -uroot -p1234 -hservidor -P3306…
-
1
votes1
answer72
viewsPowershell, shell_exec + Get-Printer
I’m trying to get a result from server B through server A, by Powershell in php. Basically I’m giving the command PowerShell Get-Printer -ComputerName (Servidor-B) -Name (Impressora) | Format-List…
-
1
votes2
answers226
viewsPowershell file output. CSV after Foreach
Good afternoon! I have a simple powershell scritp that performs the connection test between Omains controllers and their respective service ports as below: $servers = Get-Content -Path 'C:\DC…
-
0
votes1
answer43
viewsRun script on XP machines
I have a script running correctly on 7 machines, but not on XP. If it runs locally, do what you want, but not via GPO. The script checks the OR of the computer, checks a file .csv and puts icons…
-
0
votes1
answer96
viewsPowershell - the use of wildcard or similar in Set-Mailboxjunkemailconfiguration
I have been trying for some time to discover on my own, from searching on various websites, foruns etc a solution that I think is relatively simple but unsuccessful. I would like to block mails for…
-
0
votes1
answer155
viewsAWS script to delete snapshot longer than 7 days
I need to make a script to delete my snapshots in mine AWS longer than 7 days. To perform the creation use this script, I hope it helps. AWS ec2 create-image --no-reboot --instance-id i-131e8e06…
-
0
votes1
answer85
viewsGit merge in windows conflicts and the line in the file is not marked
When trying to perform a git merge on Windows in a file that has been modified on the same line, the message is displayed: warning: Cannot merge binary files: g.txt (HEAD vs. feature3) Auto-merging…
-
0
votes1
answer324
viewsFailure in Powershell, it cannot be initialized, file blocked by software restriction policies, how to fix?
I was using the package manager console in Visual Studio 2015, when opening the powershell appeared a message if I wanted to run it in an unreliable source file, I clicked yes on showed this message…
-
0
votes1
answer115
viewssearch thousands of strings in thousands of files
I have the following problem: our system is parameterizable, and these parameters are in a table. But over the past 25 years, many programmers have tampered with the system and created and used…
-
0
votes0
answers191
viewsPowershell Get-Aduser -Ldapfilter command for searching all users outside a group
What is the command to search all domain users that do not belong to a certain GG? I’ve tried using: Get-ADUser -ldapfilter {(&(name*)(!memberof=*GG_DI-ADM))} -properties * | select name,…
-
0
votes1
answer34
viewsTerminate remote script as Failure
I want the remote script in a given condition to end with error and exit as Failure. if (($siteExists -eq $null) -and ($siteExistsInRecycleBin -eq $null)) { write-output "info: Creating…
powershellasked 7 years, 5 months ago claudio.aguiar 1 -
0
votes1
answer93
viewsHow to create a Powershell Script to start an EC2 instance and capture public IP?
would like to create a Powershell Script that runs the following steps: 1 - Start an EC2 Instance in AWS (Windows); 2 - Wait for it to be available for remote connection. While waiting, display a…
-
0
votes1
answer524
viewsHow to put space before the SET/P variable in Batch?
I intend to set the variable in the middle of the screen, but I can’t place it! |____não_funciona____|set /p variável=um |____funciona____|%variável% Thanks in advance!…
-
0
votes1
answer810
viewsSearch and copy file using Powershell ISE
To copy png image files from one disk to another, we use: Copy-Item "D:\" -Filter "*.png" -Destination "F:\Files_PNG" -Recurse -Force Copies the files and the Directories structure. What parameters…
powershellasked 6 years, 2 months ago soushinsha 65 -
0
votes1
answer2444
viewsList installed print server printers from a remote station
I work in a company that has the following structure: Each city of my state has a headquarters with a server that is also print server, in it are the printers of this headquarters. I use the psexec…
-
0
votes0
answers29
viewsmkvextract giving error in windows
I installed the MKVToolNix on my computer and put the folder in the environment variables. When using the MKVExtrac in the Arquivo.sh, it presents the following error: What could be causing this…
-
0
votes1
answer446
viewsPowershell (new-Object System.Net.Webclient). Downloadfile Strings as Arguments
I have the following code that I use to download the last chromedriver for a specific folder: (new-object…
-
0
votes1
answer933
viewsLogging a batch file
I have the following problem: We receive a daily backup of the database from 4AM to 5AM, and we have a batch job running at 6 AM to get this database running on a VM. In Task Scheduler, everything…
-
0
votes1
answer262
viewsVariable in a url by powershell
I’m building a script that takes an answer from a url and uses this answer to build a second url. Example: $id = Invoke-Webrequest -Uri "http://meusite/login? blablabla" This first request will…
-
0
votes1
answer48
viewsHashtable in powershell
I apologize in advance for my inexperience! So I have the following hashtable: @{Name=Useragent; Value=Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0} @{Name=Flowtokenscenario;…
powershellasked 4 years, 8 months ago Gustavo Neves 1 -
0
votes1
answer36
viewsChange another user’s records with powershell credential
Someone knows how to change a record having the credential created. I need to change a value inside HKEY_CURRENT_USER but another user, I saw that cmdlets Set-Item has the -Credential parameter, but…
powershellasked 4 years, 4 months ago Everton Esteves 21 -
0
votes1
answer109
viewsFilter AD User - Powershell/CSV
Dear colleagues, I need to read a CSV file and filter the users within the AD with the information contained in the CSV. I need to compare the CSV field with the Userprincipalname inside the AD. My…
-
0
votes1
answer139
viewshow to execute a powershell command inside a window started by a script
I have a script.ps1 file and the first line of it is to open another powershell window: powershell Start-Process powershell -Verb runAs But the problem is that I need to execute other commands…
powershellasked 3 years, 11 months ago Samuel 99 -
0
votes1
answer33
viewsCompressing files in Powershell 4
I have Windows with Powershell 4 on a server. I would like to compress files, and for that I know the Compress-Archive of Powershell. How do I install it? You need to touch . NET Framework? In…
-
0
votes1
answer171
viewsConcatenate . html files into a . htm with Powershell
So, I need to concatenate thousands of . html files to just one . htm, there’s already a file. batch that does this for me, using the following code: #type *.html > output.htm @echo off for /r…
-
0
votes0
answers20
viewsHow do I pass a variable to the 7za command as a parameter in Powershell?
First of all I am using the 7za file compression system for command line, I am running Windows 10. At the following command: $nomeArq ="Nome Aleatorio.zip" 7za a -tzip $nomeArq "Minhas coisas" The…
-
0
votes1
answer120
viewsError passing variables as parameters in powershell
Hello A Powershell script has the following code: function GetPerfis { [CmdletBinding()] param( [Parameter(Mandatory)] [string]$StartDate, [Parameter(Mandatory)] [string]$EndDate ) $cmd = New-Object…
-
0
votes0
answers82
viewsBase64 conversion error
Good morning I’m trying to convert a base string 64 $b = ((New-Object System.Net.WebClient).DownloadString("domain/file") $c = [System.Convert]::FromBase64String($b) but give me the error Exception…
powershellasked 4 years, 8 months ago ampf27 5 -
0
votes1
answer38
viewsException error Calling
Good morning I’m trying to run the powershell script https://github.com/the-xentropy/xencrypt/blob/master/xencrypt.ps1 and both the script and the file I’m trying to encrypt are on the same board…
powershellasked 4 years, 8 months ago ampf27 5 -
0
votes2
answers241
viewsHow to build a json in powershell
I am creating a Powershell script that calls the POST method a REST API. Body sends a string representing a JSON object with the parameters that will be inserted by the API. Do you know how I can…
powershellasked 4 years, 7 months ago lucy 23 -
0
votes1
answer37
viewsGroup two object arrays into porwershell
Hello, I have two arrays of objects, I have to group them. That is, go through the list (object array) of "car" and when there are properties in the property_list array added to that object, which…
-
0
votes1
answer136
viewsExtract part of text in a variable
I am creating a script to backup some directories via powershell, but for a certain directory, I want to access a file, read a line and return a string with part of the line. XPTO file has the…
-
0
votes1
answer1936
viewsPowershell and VS Code does not recognize "Set-Location"
Man PowerShell does not recognize the Set-Location, this has been happening for a while now every time I run a code in VS Code because my work and projects are in the cloud and on another HD but I…
-
0
votes1
answer69
viewsDownload via Powershell
Hi, I’m trying to download Java via Invoke-Webrequest join with regex & match My script is like this: $url_download = (Invoke-WebRequest -UseBasicParsing…
-
0
votes3
answers75
viewsShellscript does not run cd, calling sh via php
all right? See if anyone has been through this, I’m with this simple code in shellscript, which access folder (/home/test4toquew5824) and then confirm if I entered the directory with pwd,…
-
0
votes0
answers45
viewsDifficulty using Invoke-Restmethod in Powershell
I am trying to create a script in Powershell, and in this script I need to take data from an application in webservice, and when doing the same, just returns as an arrayListObject, instead of the…
powershellasked 3 years, 3 months ago Andl 1 -
-1
votes2
answers597
viewsChange user password (Active Directory) using php and powershell
I need to change the password of an AD user using php and powershell would be like: connect to AD with ldap, write powershell codeline in php and run it, make it run in AD too, wrote a line to show…
-
-1
votes1
answer237
viewsWhy don’t Sass and Less work on Powershell?
I installed Sass and Less through Node.js (globally, as exemplified on the websites of the tools in question). I used both in cmd without problems, but when trying in Powershell, I received the…
-
-2
votes1
answer1333
viewsVery slow docker in Windows 10
I recently installed Docker for Windows on my laptop, however it is very slow. I own a notebook DELL Latitude 7490 with 8gb RAM, 240gb SSD and intel processor I5 8° generation - Windows 10…