Questions tagged [powershell]

An interactive shell, scripting and programming language, and surrounding environment from Microsoft. Commonly used by system administrators managing Microsoft software (including Windows, Exchange, SharePoint, and cloud services Azure and Office 365), PowerShell is included by default with Windows, and takes over from previous languages such as VB Script.

Filter by
Sorted by
Tagged with
0 votes
1 answer
533 views

How to reset the "allow pc to be discoverable on this network" prompt?

I have been advised to ask this question here on ServerFault. I've searched StackExchange, StackOverflow, and Google and I'm not finding any insights on how to reset the prompt when first connecting a ...
k1dfr0std's user avatar
  • 101
0 votes
1 answer
118 views

Connect remote machines via SSH to command prompt

I created an SSH connection between my machines, and then i set on one of them a PowerShell command telling windows to provide the PowerShell console when a distant machine connects to the current via ...
Patrick Schulz's user avatar
0 votes
0 answers
241 views

Stop/Start Azure VMs Using Hybrid Runbook

I currently have runbooks that stop/start VMs on a schedule but recently the runbook to start vms is stopped because it takes too long to complete. The following message is thrown - "The job has ...
jrd1989's user avatar
  • 688
0 votes
1 answer
2k views

I have been trying to update my SSM agent. I'm running the command AWS updatessmagent

I have been trying to update my SSM agent. I'm running the command AWS updatessmagent. This is what I am getting. PS C:\Windows\Temp> AWS-UpdateSSMAgent AWS-UpdateSSMAgent : The term 'AWS-...
Christopher Gibson's user avatar
2 votes
1 answer
494 views

SSH using public key losing Authentication on windows server

I want to SSH from my laptop (A) to Windows Server (B) and run commands against SQL Server (C) from powershell. All three in one windows domain. I'm running built-in openssh server and client for ...
Mak Sim's user avatar
  • 131
0 votes
1 answer
2k views

Running Powershell scripts pushed from AD GPO as admin on domain computers

Needed some help getting a simple task done at work. I have about 30 machines in my work domain that i want to run a power-shell script on at startup. I have created a GPO that runs the script on all ...
Shehab's user avatar
  • 1
1 vote
1 answer
230 views

Retrieve parent folder size for each IIS site

Im trying to get a list of sites from IIS (8.5) to include the folder size but cant get this to work. Below is the current code i have that is working without the size Import-Module webAdministration #...
Computer's user avatar
  • 111
3 votes
1 answer
3k views

How to add custom scripts to the MDT?

I have setup MDT using the steps provided in this link When I am trying to edit the task sequence and add my own script, the ps1 file is not downloading on the target machine and not running. Attached ...
Sara June's user avatar
  • 521
0 votes
0 answers
183 views

Copy files from the same subdirectory to the same Directory in Windows

I am having a hard time describing the problem and I can't find the solution anywhere so here is an example SourceFolder\ProjectA\Legal\ContractA.txt SourceFolder\ProjectB\Legal\ContractB.txt ...
Artrelay's user avatar
0 votes
1 answer
696 views

how to Extract multiple OU name using Powershell's Get-ADOrganizationUnit & Get-ADComputer

In AD hostnames are created under location OU, inside location OU under computer sub OU. i need a script to extract both OU in excel. i am able to extract one OU details through below scrpit Get-...
darshan kumar's user avatar
0 votes
2 answers
433 views

How to properly display accentuated characters in a check_nrpe result based on a Powershell script?

I have a custom Powershell script called by Nagios using "check_nrpe". Currently all check results output messages with special characters like 'è', 'é' or 'à' are not displayed properly ...
donmelchior's user avatar
0 votes
3 answers
1k views

How to Find all Members of Windows Security Group in PowerShell, Assign to Variable Names and Output to CSV?

I'm not a sysAdmin/PowerShell guy per se, but am having trouble getting this Powershell query to work. The need is to pull back all users in a specific Windows Security Group and format them in a ...
Tikhon's user avatar
  • 97
0 votes
0 answers
107 views

GIT-SCM bash.exe doesn't work from "Enter-PSSession -Computer myServer"?

Let's suppose I download and install Git-SCM on a remote windows 10 computer using this installer: https://github.com/git-for-windows/git/releases/download/v2.33.1.windows.1/PortableGit-2.33.1-64-bit....
pico's user avatar
  • 121
0 votes
0 answers
213 views

SQL Availability Group Failover Automation through PowerShell - Slow response

I am trying to automate the process of failing over AGs on SQL Server 2017 and I run the below command remotely through PowerShell over remoting (port 5985) Invoke-Sqlcmd -ServerInstance .\INSTANCE01 -...
Steve's user avatar
  • 111
0 votes
1 answer
304 views

Filtering results for date but getting system.type error

I'm trying to filter certificates on my local machine and remove all created before 4/10/2021 PS C:\Users\juraj> $cert = Get-ChildItem Cert:\localMachine\My | Where-Object { $_.NotBefore -is [...
JurajB's user avatar
  • 188
0 votes
1 answer
304 views

PowerShell Remoting - Certificate Authentication

I am trying to remote to a different server using certificate authentication - this was previously working. However I now get this error when I try to connect: An attempt has been made to operate on ...
usabletech's user avatar
0 votes
1 answer
237 views

Windows scheduled task - task with cmd script runs, but .NET console app doesn't

I'm creating Windows scheduled tasks in a Docker container with Powershell. As a test, I've got a simple batch file which writes the current date/time to a text file once an hour. This works perfectly:...
user873725's user avatar
0 votes
1 answer
455 views

update XML duplicate named section with Powershell

Using Powershell, I would like to update Outlook's compatible status to True <default> <application>Excel.exe</application> <compatible>True</compatible> <...
Eric's user avatar
  • 1
0 votes
1 answer
2k views

Add office365 Sharepoint library to OneDrive Sync

I'm working on automating the OneDrive setup for new computers, and I'm new to this kind of thing. I need to automate the Sharepoint shared library setup on the user computer. This way the user has ...
Waldo's user avatar
  • 113
1 vote
0 answers
2k views

Calculate Size of Azure Storage Accounts & Containers Using PowerShell

I have limited knowledge of PowerShell but I'd like to calculate the total size (in GB) of each storage account, or each container in my storage accounts. I have multiple storage accounts and ...
jrd1989's user avatar
  • 688
0 votes
2 answers
270 views

PowerShell: Why am I getting this error?

I am trying to use the PowerShell Invoke command. I am using it correct but I don't know why I am getting an error. Invoke-Command Get-EventLog –LogName Security –Newest 100 -ComputerName WIN-...
Tony Chong's user avatar
0 votes
1 answer
1k views

Can't install SqlServer PowerShell module 21.1.18256: PackageManagement\Install-Package : Access is denied

I have servers which have no access to the Internet so I have an internal PSRepository. I've downloaded the current SqlServer module (21.1.18256) and published it to my internal repo. I've installed ...
user2871239's user avatar
0 votes
0 answers
114 views

How to merge two data sources with slightly different folder names

How can I copy all .msg files that are spread throughout some GUID sub-folders in one folder to another folder that has a slightly different folder name at the end. Is it possible? So for example: ...
Damian's user avatar
  • 1
1 vote
0 answers
227 views

Adding multiple virtual switches to New-VM?

I'm working on a Powershell script to create new virtual machines as part of a migration between a Hyper-V server running Hyper-V Server 2012R2 and a new Hyper-V server running Hyper-V Server 2019. ...
Davidw's user avatar
  • 1,247
0 votes
0 answers
1k views

Executing a PowerShell Script With Spaces in Arguments via Task Scheduler on Windows Server 2012

I'm attempting to create a scheduled task on Windows Server 2012 that will execute a powershell script that will create an archive of a specific directory once per day. The arguments to execute the ...
Daniel's user avatar
  • 119
-1 votes
1 answer
2k views

Programatically get full path to binary in powershell (which, where, Get-Command)

How do I get the absolute path to a given binary and store it to a variable? What is the equivalent to the following for Linux Bash in Windows Powershell? user@disp985:~$ path=`which gpg` user@disp985:...
Michael Altfield's user avatar
1 vote
1 answer
1k views

Script to Create IIS Site Failing

I am trying to use the new IISAdministration module to create an IIS site (I know I can use the old WebAdministration module, but this is now the recommended approach). When I run the following script,...
onefootswill's user avatar
0 votes
1 answer
7k views

Change AD Display name from Lastname, Firstname to Firstname Lastname

My organization wants to change the Display name format to Firstname Lastname instead of Lastname, Firstname I already change the format for creating new users in the ADSI settings. But want to change ...
ricardovand3rlinden's user avatar
-3 votes
2 answers
4k views

how to determine if I have the latest security update or not by powershell?

I'm a beginner to exchange server and powershell, I'm working on Exchange server (on-premise), how can I determine if I have the latest updates, security update, version of windows server (core) and ...
Ali Muhanad's user avatar
0 votes
1 answer
199 views

Manage Services within Azure VM from Automation Runbook

I'm looking to use Azure Runbooks (powershell) to automate the shutdown/startup process of a few Azure virtual machines. The VM's are running 3rd party reporting tools, some of which take a few ...
jrd1989's user avatar
  • 688
0 votes
1 answer
239 views

How to stream tar archive using plink?

I'd like to stream a .tar archive from a Windows machine using PowerShell to a Linux machine and extract the archive from the stream. PowerShell pushes archive content to stdout and plink.exe stream ...
Licensed Slacker's user avatar
0 votes
1 answer
479 views

How to know in my network which computers have the local administrator account active

As the title says: How do I know in my network which computers have the local administrator account active? Because, as per security consultant request, we have to know, and if possible, disable, ...
sataranights's user avatar
0 votes
0 answers
606 views

How to get PhysicalLocation disk on Windows 2022 like on Windows 2019 via powershell

On Windows Server 2019 i usage Get-PhysicalDisk | foreach {$_.PhysicalLocation} its return SCSI0. This is exactly what I need. But on Windows Server 2022 its return PCI Slot 160 : Bus 3 : Device 0 : ...
Maksim Sholomov's user avatar
1 vote
2 answers
625 views

Prevent users from uploading files when they are on external networks

Is there a way to prevent users from uploading files when they are on external networks? The reason for this is internal security and protection of company confidential documents. They should be able ...
Zoran Jankov's user avatar
0 votes
1 answer
676 views

How can i change parent container reversed in powershell?

I have the need of extract all users of AD with all information about them adding a field with "parent container" field reversed For example: Actual parent container field: "OU=Users,...
Claudio Aunós Prado's user avatar
1 vote
2 answers
173 views

Show clear names instead of anonymous names in Office 365 Report- PowerShell or Graph

Microsoft has made anonymous display of user-names as default in Office 365 and also enforced it from August 31, 2021. I found a way to overcome it from Admin Portal. https://docs.microsoft.com/en-us/...
Tony's user avatar
  • 13
0 votes
1 answer
779 views

Windows Server 2019: Install the Certificate for an Issuing CA (signed by offline Root CA) using PowerShell

I'm working on automating the deployment of a multi-tier PKI system based on ADCS (I have a general product IT solution that we then deploy on projects mostly in a cookie cutter fashion). I have the ...
Helstrom's user avatar
0 votes
3 answers
4k views

Uninstalled Program(s) still appear in WMI Object “WIN32_InstalledStoreProgram”?

Note: This is a repost from an original post on StackOverflow. I was directed here by a helpful user, and am simply reposting. I made a StackOverflow account for the first time due to this annoying ...
BurgundianM's user avatar
1 vote
2 answers
2k views

How to add permissions to windows named pipes using powershell?

How can i add permissions for a specific group to read/write from an existent named pipe, using a powershell script? This is as far as i went: $AccessRule = New-Object System.IO.Pipes.PipeAccessRule( &...
Miguel's user avatar
  • 571
0 votes
2 answers
2k views

Query IP/hostnames in local network (Windows)

I have a Windows Server based network, running a Windows DHCP and DNS server. How can I list all the computers in the local network known to the server? That would mean querying either the DHCP or the ...
jdm's user avatar
  • 211
-1 votes
1 answer
176 views

Windows Server 2019 - renaming files with some naming convention

We received a ton of files from our sponsor and the files are all formatted like this [ABCD] Title - Id - Description [RS][x264][CHKSUM].txt I could manually rename one at a time but there are more ...
GettingStarted's user avatar
1 vote
0 answers
474 views

WDAC policy not accepting MS signed DLLs

I'm working on WDAC / windows defender application control policy. Around 80% of what I have left is from system32 DLL files, hundreds of them. Windows 10 client systems, mostly 20h2. The base policy ...
Tim Brigham's user avatar
  • 15.6k
0 votes
1 answer
1k views

Get all hostnames in local DNS for current Windows server

I've deployed BGInfo from SysInternals to all of our servers, both physical and virtual. However, a few of our servers have multiple hostnames to support "backward compatibility" with some ...
G_Hosa_Phat's user avatar
0 votes
1 answer
877 views

Exchange Server 2016 - identify full hybrid and/or minimal hybrid using or not

We have 2 Exchange Server 2016. I want to check it if I am using Full Hybrid and / or minimal hybrid in our environment. What should I understand from the following output? get-hybridconfiguration ...
Cell-o's user avatar
  • 327
0 votes
1 answer
113 views

Parse Service Pathnames

(get-ciminstance cim_service).pathname outputs something like: C:\WINDOWS\system32\msiexec.exe /V Does anyone know of a solution to remove all arguments and options from the output? Or a method of ...
RevoCaine's user avatar
0 votes
2 answers
2k views

Wildcard doesn't work in ansible shell command

The shell command doesn't expand wildcard when running ansible module through powershell. If I remove the wildcard and specify the version number it works 'rabbitmq_server-3.9.3'. Any suggestion on ...
user630702's user avatar
1 vote
0 answers
797 views

Ansible powershell scripts not working - script is not recognized as the name of a cmdlet

I'm trying to stop windows services using ansible but I get the error 'script is not recognized \r\nas the name of a cmdlet." Here is the task in the Ansible yaml file: - name: Check if ERL is ...
user630702's user avatar
0 votes
2 answers
2k views

bulk removing direct access to a folder via PowerShell ACL

On a number of the servers where I work the share folder permissions have become cluttered with direct permissions for some of our techs due to them needing to take ownership. I have figured out how ...
Robyn H's user avatar
-2 votes
1 answer
2k views

How to make a change in iis apppool using appcmd.exe

I want to edit the parts marked in the photo using appcmd.exe or another comman-line method.
User12's user avatar
  • 109
0 votes
1 answer
2k views

Retrieve and install pending certificate by PowerShell

I am requesting a certificate that must be approved by the CA administrator. When I make the request, it appears in the CA pending request folder and I right click to issue the certificate. In client ...
Elmano Francisco Gonga's user avatar

1
5 6
7
8 9
83