138 questions
-1 votes
1 answer
217 views
Choose between E3, E1 based on available licenses
I'm looking for a way to add an E3 or E1 license to a user based on the availability of the license. For example: If there's no E3 license anymore, add then an E1 license. What I do, I use the Set-...
0 votes
1 answer
3k views
New-ADUser : The server is unwilling to process the request
I am using PS to add users to AD using input data from a CSV file, but I keep getting the error: The code and csv will be attached to this post, any pointers or insight leading to a solution will be ...
0 votes
1 answer
86 views
Comparing two sets of folders and files in Powershell v1.0
I want to generate a report which highlights only the differences between two directories, each on a different remote machine, complete with subdirectories and duplicate file Names. I need two lists: ...
1 vote
1 answer
1k views
Get-ADComputer, some -Properties not showing up in Format-Table
I am gathering a list of all computers on my domain and trying to display some specific properties in a formatted table. This is the command I'm using: Get-ADComputer ` -Filter "objectclass -eq '...
-1 votes
1 answer
809 views
How to convert some of log file content to table format using powershell
I am trying to read some of bottom lines from my log file and send the content as a table in the email. Log File: 0 \\Server\Copy\db_materials\TEST\ Total Copied Skipped ...
0 votes
1 answer
343 views
Setting up a JSON object as a variable in a linux Powershell script
I am currently sending in a list of key value variables from octopus to my project into my prompt. These are read and set in my environment by the code below. $testKeys = $OctopusParameters.keys | ...
0 votes
0 answers
30 views
String failing to concatenate in PowerShell [duplicate]
[Note, this is a repost of a question that failed to demonstrate the problem as it only used snippets of my actual code. This is the actual code and this definitely fails on my system] I'm trying to ...
0 votes
0 answers
2k views
Need help decoding base64 compressed string in a powershell script
I found a powershell script dropped by a trojan, I am not familiar with powershell. So I am just curious to see what it looks like inside but the script is encoded and I am not able to decode by basic ...
0 votes
1 answer
726 views
Creating Local Group and Adding A User To The Group
I have a PowerShell script that builds IIS sites and configures settings. Most of it works as expected except for a function to either add a domain user to a specific local group or if the group is ...
0 votes
1 answer
2k views
Powershell -NoNewWindow not working as expected
Basically I want to switch user in powershell in the same window (dont want to open a new one). $username = "xxxxx" $password = ConvertTo-SecureString "xxxxx" -AsPlainText -Force $creds = New-Objet ...
1 vote
1 answer
5k views
Find the key and replace its respective value in config/xml files using PowerShell
I have an config file similar to below: <?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=...
5 votes
3 answers
1k views
Random linebreaks in PowerShell standard error output
I want to convert many .iso files to .mp4 with HandBrake, so I am trying to use the command line interface. I would prefer to write my scripts for this in powershell instead of batch files. However, ...
0 votes
2 answers
1k views
Select (or split) column from SQLCMD output
How do I select the columns from SQLCMD output in PowerShell v1? I'm trying to make JSON output using Write-Output in PowerShell v1. Query output at the end. $_ returns both columns. If only we ...
1 vote
2 answers
84 views
Terminated & Not In Group
I'm trying to generate a report for all disabled accounts that don't have the group "Terminated Employees" but it isn't seeming to generate the report. Below is the code that I have at the moment. ...
1 vote
1 answer
1k views
Powershell command from batch file not working as expected
I am running a batch script, but I get an error stating that -command is not recognized as internal or external command, operable program or batch file I am not able to understand why. I also ...