4,439 questions
1
vote
2
answers
53
views
How to Parse and format fields to use a period as decimal separator, without thousand separator in Powershell Script
How to Parse and format fields to use a period as decimal separator, without thousand separator in Powershell Script
Need to covert from European number format to standard format given below
Desired ...
1
vote
3
answers
76
views
How to add single quotes to one of the columns in PowerShell?
I have the following lines in a file:
pc_cc_text$fx_review1 CONSTANT VARCHAR2(100) := 'For Company Review'; -- AD_PRT_AUTH_(MSP)
pc_cc_text$fx_review2 CONSTANT VARCHAR2(100) := 'For Dept Review'; -- ...
0
votes
0
answers
39
views
powershell scripts for aws lifecycle policy
I have a power shell script which reads the lifecycle policy using
lifecycleConfig = aws s3api get-bucket-lifecycle-configuration --bucket $bucketName
It returns the lifecycle policy but when there is ...
0
votes
2
answers
132
views
Performance Counter Report w/ Powershell and Cooked Values
I'm trying to capture available size, remaining size, and a number of logical disk counters for my D:\ drive. however the following are the results I get
"Used Space" and "Free ...
0
votes
1
answer
56
views
trying to write a PowerShell script to look for certain strings in a text file
I am trying to write a PowerShell script to look for certain strings in a text file but not getting very far.,
What I want to do is:
Search line by line until "set name 'Web Traffic Filter - ...
0
votes
1
answer
100
views
How to run multiple commands at once with pause in PowerShell?
I want to run multiple commands at once with pause and but I'm not sure how. Here's my current code:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
ipconfig /registerdns
ipconfig /flushdns
...
0
votes
1
answer
25
views
Having problems with PowerShell
Anyone know how to open a directory in the PowerShell console so that I can find how many things are in my downloads file.
I tried to type "dir" however, It did not give me what I was ...
0
votes
2
answers
89
views
How can I read and use the value of pipeline environment variable into my PowerShell and use that value subsequently on my URL of API Call?
I have created an pipeline variable on my release pipeline and I am able to read that value in my powershell script as well, the problem is that the value of that variable is not being populated/...
0
votes
0
answers
92
views
Why doesn't this Powershell 2.0 script properly title the generated command prompt windows?
This script is intended to create 3 command line windows that repeatedly display ping results to three specific IPs on an intranet network so the status of each connection can be monitored at a glance ...
0
votes
0
answers
96
views
Running Powershell commands using Paramiko in python in a remote Windows 7
I'm using paramiko in Python to send commands (and retrieve data) from another server.
When I send a Powershell command to Windows 10 server it all works OK.
But when sending this to Windows 7 it ...
0
votes
2
answers
218
views
Add-AzTableRow throws error MethodInvocationException : The specified resource does not exist
We are encountering an error when attempting to add a new row to an Azure Storage Table using the -UseConnectedAccount context rather than a key based authentication in PowerShell.
Error Message is:
...
0
votes
0
answers
400
views
'invoke-pnpsitetemplate : object reference not set to an instance of an object.'
We are trying to apply pnp-template by following this article. https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/applying-pnp-templates
I have downloaded the 'theperspectivepnp' from ...
0
votes
0
answers
85
views
How can I get all possible IP addresses when allowing a domain in windows firewall?
I am trying to create a domain whitelisting job where I am blocking the default outbound action and allowing a single domain or multiple domains. This is working fine but I found that some sites ...
0
votes
0
answers
73
views
PS: Convert a IP address range to subnet mask
I have a range of IP addresses, which I need to convert into a subnet format to add to IIS for blocking / allowing them.
Can someone help me with a power shell function to convert an IP address range ...
1
vote
1
answer
2k
views
Need to install Microsoft Visual C++ 2015-2022 via Powershell
I have to install the below Visual C++ software via powershell.
VC_redist_2015-2022x64
VC_redist_2015-2022x86
I have to first check whether the Visual C++ x64 & x86 installed on my server. If ...
0
votes
1
answer
112
views
PowerShell problem with database restore, mdf file is claimed by another file. The WITH MOVE clause can be used to relocate one or more files
this is my script that I execute to restore database on remote sql server instance:
param(
[Parameter(Mandatory, HelpMessage="Enter the SQL Server hostname. I.e 'plwron164\sql2014'")]...
-1
votes
2
answers
794
views
how to get all lists in a ShrePoint site using SharePoint Online Management Shell cmdlets
when I was working with SharePoint Online using PowerShell, I had a requirement to get all the List collection present in my SharePoint site.
I got all the lists using PnP PowerShell commands. But i ...
0
votes
1
answer
237
views
Not listing the files and folders inside the azure file share
$resourceGroupName = "xbackbonektadevmc-rg"
$storageAccName = "xfssaktamc601"
$fileShareName = "imagingcenter"
$directoryPath = "Software\KTA OPMT\KofaxTotalAgility-...
0
votes
0
answers
87
views
Issue with my powershell script aimed to kick off a jenkins job
$UserName = "user"
$Password = "password"
$API_URL = "https://jenkinsservername"
$JobName = "firstjob"
$JobToken = "generatedtoken"
$header = @{}
$...
0
votes
0
answers
48
views
Looking for a list of service accounts that have read or write ability in Active Directory
I am looking for a list of service accounts that have read or write ability in AD.
If all of the service accounts have that ability, then I might be looking for service accounts that query active ...
0
votes
1
answer
253
views
How to add SharePoint list items using SharePoint Online Management Shell?
I tried to add the SharePoint list items using PnP PowerShell using the "Add-PnPListItem" command.
I need to add the SharePoint list items using SharePoint Online Management Shell.
Suggest ...
2
votes
2
answers
512
views
how to delete SharePoint Group connected sites using PowerShell?
In SharePoint, I need to delete a SharePoint group connected sites through PowerShell, but i was facing an error
This site belongs to a Microsoft 365 group. To delete the site, you must delete the ...
0
votes
2
answers
96
views
Doubts about code to remove part of the text in PowerShell
I have the following code that I found on a website, it monitors a folder and saves a log in .csv. However, I need the log to contain only the name of the file I saved, without the path and extension
#...
-1
votes
2
answers
358
views
PowerShell script to export Array in CSV format with Headers
I've below PS Script which connects to API and puts responses on an Array List.
I'm struggling to convert Array List to CSV file and giving them a Column Header.
Anyone got Idea how to this can be ...
0
votes
2
answers
67
views
How to address mutable parameters like datatime in Powershell?
We have a server that is running out of space (435Gb remaining) and we want to know when it will as new 1Gb files are created every 15 hours consistently. So, I've crafted a script where users can ...
0
votes
1
answer
51
views
Fetch all the files in a folder but exclude all the files in a sub folder by using powershell
I have a powershell script to fetch all the files in a folder but exclude all the files in a sub folder. I am using the following script, but not giving the expected results.
Get-ChildItem -Path $...
0
votes
1
answer
67
views
PowerShell : need to Compare the 2 csv, compare files first column of each and get the matching values 2nd column from 2nd file [duplicate]
I have 2 csv file. 1st file have deviceName and 2nd file have deviceName and id as a header of the column.
I need to check if the first file deviceName is present in file first column deviceName and i ...
1
vote
1
answer
248
views
Passing admin credentials in Start-Process cmdlet
I am trying to build a script that installs an application with encrypted local admin credentials on the pc when the user logged in is not an admin.
I am running the below cmdlet:
$User = "admin@...
1
vote
1
answer
176
views
How to ensure Export-Csv is in same column order?
I have the following PowerShell code that imports a csv (that has 35 column) and modifies the "Account" column. It's working as expected. However, when I export, it's adding it as the first ...
0
votes
0
answers
25
views
Fetching user-related details and multifactor authentication methods for specific users or all users using powershell mg-graph
Fetching user-related details and multifactor authentication methods for specific users or all users using powershell mg-graph
Written function to get the user details using MG-Graph but not able to ...
0
votes
0
answers
46
views
Transfer MetaData from JSON to sharepoint column
We have sharepoint site where meta data (doc id, auther, and modified date are stored in json. Now we need get it in sharepoint columns.
I tried pnp powershell command
[System.Net.WebClient]::new()....
0
votes
1
answer
153
views
Add https://outlook.office.com/Exchange.ManageApp API permission to enterprise app
I am trying to register for Enterprise App from Web Application via MSAL. When I tried to add "https://outlook.office.com/Exchange.Manage" Scope it throwing error
asked for scope 'Exchange....
1
vote
1
answer
684
views
Trying to create a scheduled task from a powershell script but continue to receive the error "register-scheduledtask : the parameter is incorrect
I am trying to create a scheduled task via a powershell script that will automatically execute a batch file when the local admin account logs in. For reference, I have the script updating the registry ...
0
votes
1
answer
70
views
How to hide redundant argument values appear in the console, when using Powershell @2?
I have a pipeline which is running a series of Powershell@2 task.
Since last Friday, I started to see the output different from before. Please check the current output below:
enter image description ...
1
vote
1
answer
96
views
why commands in command line starting with python is not working and giving output "Python"?
When I'm running a command starting with python in Windows PowerShell I always have just output "Python"
Example:
PS C:\Users\----\Django\jobapp> python -m venv env
Python
Example 2:
PS ...
0
votes
1
answer
882
views
After Running a Custom Scirpt in Power Automate how to get the Output in a new Variable
I am running a custom PowerShell Script in Power Automate desktop
this is the script
# Get the 1st day of the current month
$now_date = Get-Date -Day 1 -Month (Get-Date).Month -Year (Get-Date)....
1
vote
1
answer
55
views
PS 2.0 versus PS 5.0 issues and empty Data Arrays - how to fix
I have an issue with Powershell version 2.0 and I am limited to using it for the below purpose.
I am trying to manipulate certain files using the following code:
But in version 2.0 when I pipe a ...
1
vote
1
answer
432
views
Foregroundcolor is not being set correctly inside ScriptBlock
Edit: The issue I'm facing is from an ADO pipeline
I have a ps1 script that does parallel execution. I want to set the foreground color to green but the code is not working when I am setting it inside ...
1
vote
1
answer
372
views
Suppress prompt confirmation for Import-Module PowerShell?
I am trying to import akamaipowershell powershell module using script while importing it prompts for install nuget package but I want to skip that prompt same as NO.
Import-Module ./akamaipowershell -...
0
votes
1
answer
47
views
I am encountering an error while attempting to retrieve domain policies and organizational units (OUs) within the domain
I am encountering an error while attempting to retrieve domain policies and organizational units (OUs) within the domain.
script:
Import-Module GroupPolicy
$forest = [System.DirectoryServices....
0
votes
0
answers
73
views
Use same powershell module with different instances in same script
So, I have a PowerShell module that I want to use called psPAS. Its a wrapper containing APIs for CyberArk software where we use New-PASsession (and pass the URL) to authenticate to CyberArk ...
0
votes
0
answers
26
views
Applying SameDefinition for SameType on PS
can I shorten the following definitions as much as possible?
function Get-Info {
[CmdletBinding()] Param(
[Parameter(Position = 0, Mandatory = $True)][String]$A,
[Parameter(...
1
vote
0
answers
52
views
Powershell code for admin users in AD GROUPS
new to this sorry.
I have a list in notepad of LA GROUPS (example: LA-AAAAAA, LA-BBBBB, L-CCCCCC), and I need to find out a way to get the all the active users in these groups.
LA-AAAAA is created ...
0
votes
1
answer
119
views
There is an PowerShell script, I just want the output should be stored in the CSV format
I have one powershell script, this script is supposed to execute on Domain controller. The script which is executed from Domain Controller server will fetch all the member server details and will ...
0
votes
1
answer
21
views
When trying to kill some particular service through PowerShell, if I found the word @LM_CRITICAL[5310] in txt file. But its not working
I have to kill Processservice.exe service through powershell code, If I found the particular word "@LM_CRITICAL[5310]" in txt log file. I am not getting any error and its not working as ...
0
votes
0
answers
78
views
Azure VM Restore in Parallel
When I try to run Parallel VM restore in PowerShell. I receive the following error message. We have functions for restoring VM, but the Parallel one does not work. Could someone please assist me with ...
0
votes
0
answers
57
views
PowerShell: Assign an array to nested property in JSON
I have a nested Json property which I need to replace with new values. Basically I need to update one nested Json property which is an array of objects.
This is the steps I have done so far-
read and ...
0
votes
1
answer
93
views
get text inside a section and remove the empty section in PowerShell
I have a file with below content
parallel (
{
some content 1
some content 2
build ( 'Job3', parameter5: value5)
some content 3
some content 4
}
)
...
0
votes
1
answer
192
views
Powershell and windows command to perform sed operation
I have shell command which will replace the pom version in all the pom files across the project, am trying to get the equivalent command for powershell and windows which does the required operation.
...
1
vote
1
answer
132
views
Replace a value with regular expressions in PowerShell
I have a value assigned to variable, trying to add this value to another varible inside some regular expressions.
$displayName= "revison"
$updateddisplayName = "updateddisplayName = &...