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
-2
votes
1answer
28 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:...
0
votes
0answers
15 views

use Test-VHD cmdlet without hyper-v installed role

I wrote a powershell script to have a vhdx image from physical server using Disk2vhd cli with schedule and retention. Disk2vhd doesn't have an exit code so I cannot understand when it works and when ...
0
votes
1answer
38 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,...
0
votes
1answer
42 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 ...
0
votes
0answers
28 views

Why can't I create child domains in a forest?

I'm pretty new to AD DS. So, I'm using Windows Server 2012 R2 and I'm trying to create a child domain (ch01) inside the forest(test.com). When trying to add with server manager's roles/features method ...
-3
votes
2answers
37 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 ...
0
votes
0answers
6 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 ...
0
votes
0answers
17 views

Cannot live migrate VM from certain user on certain host

Layout Forest A Forest B Forest ForestA ForestB Domain DomainA DomainB Computers ComputerA1, ComputerA2 (none) User UserA UserB Administration ForestA trusts ForestB ForestB trusts ForestA ...
0
votes
1answer
32 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 ...
0
votes
0answers
14 views

Add in Active Directory security groups automatically using PowerShell

I have built an onboarding Powershell script to help our IT team simplify onboarding process. Script will add in some necessary AD fields, assign a mailbox and add in Security groups. After creating ...
0
votes
1answer
23 views

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

As the title says: How do I know in my network wich computers have the local administrator account active? because, as per security consultant request, we have to know, and if possible, disable, every ...
0
votes
0answers
15 views

How to write a powershell script to remove all AD Group permissions for a user?

I'm in a rather large company and often have people change roles which requires changing of AD permissions, the process is in need of streamlining, currently there exists a script which copys ...
0
votes
0answers
86 views

Adding "Never saved" websites to Edge via Group Policy, Registry, Script, etc

I would like to push "Never saved" websites to users' Chromium Edge settings. The goal is to disable password saving for these particular websites/domains. The method doesn't matter, only ...
0
votes
0answers
10 views

Creation of a windows service with credentials powershell

I am trying to create a powershell script that can set up and configure a windows service on application server [string]$serviceAct = "myadminact" New-Item C:\Temp\pas.txt Set-Content C:\...
0
votes
0answers
20 views

"logon session does not exist" when cmdlet wrapped in do-nothing Invoke-Command

While logged into HOST1, my user can successfully run this powershell command to move a running VM from HOST1 to HOST2: Move-VM -Name DC02 -DestinationHost HOST2 -IncludeStorage -...
0
votes
0answers
30 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 : ...
0
votes
0answers
21 views

Import Servers from AD using OU names as Groups in RDCMan

I have been trying to write a PowerShell script that will create a .rdg file for me that holds my credentials, and mirrors exactly what the AD OU structure looks like (sub OUs as Groups) into RDCMan. ...
0
votes
1answer
34 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 ...
0
votes
1answer
26 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,...
1
vote
0answers
13 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/...
0
votes
0answers
20 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 ...
0
votes
1answer
57 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 ...
0
votes
0answers
11 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( &...
0
votes
2answers
64 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 ...
-1
votes
1answer
51 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 ...
0
votes
0answers
29 views

How to trigger automatic driver installation for a specific device from the commandline?

When you open the properties window for a device in the device manager there is an "Update Driver" option that allows you to automatically check if Windows Update has a driver for that ...
1
vote
0answers
37 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 ...
0
votes
1answer
47 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 ...
0
votes
1answer
21 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 ...
0
votes
0answers
17 views

Powershell DSC for installing

0 I have the configuration for installing the Azure backup agent and I need to add my own custom records to the appropriate Windows Event log, so I use the following code: Log LogExample{ DependsOn =...
1
vote
1answer
60 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 ...
0
votes
1answer
71 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 ...
1
vote
0answers
25 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 ...
0
votes
0answers
16 views

Remove attributes from IIS applicationHost using WebAdministration module

In IIS, the physical path credentials are set in applicationHost.config like so: <virtualDirectory path="/" physicalPath="C:\Path\to\files" userName="user" password=&...
0
votes
2answers
48 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 ...
0
votes
0answers
27 views

Finding all accounts without a domain in proxyAddresses (or Where-Object FilterScript on array that doesn't contain entry by wildcard)

I'm trying to get a list of Active Directory accounts that don't have a an address with a given domain name in their proxyAddresses. I know that to find ones that do, I can do: Get-AdUser -Filter '...
-2
votes
1answer
27 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.
0
votes
0answers
31 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 ...
0
votes
0answers
44 views

Local Admin Password Solution showing 1 password from non-admin PowerShell

We run the following command to check and make sure systems have their LAPS setup correctly. We are supposed to do this from an elevated PowerShell prompt and it works fine. When we run it as a non-...
0
votes
1answer
23 views

I'm trying to find the printer share name with the IP address of a network connected printer

I often need to find the Windows print queue name or share name of a printer connected to our network using just the IP address of the printer. I can use PowerShell to list all of the printers on a ...
0
votes
0answers
33 views

Disable RDP for a local administrator with powershell

I've gone through a ton of online threads to no avail. I'd like to disable RDP for a local admin on multiple Windows Servers with powershell. I've found ways to disable it on gpedit's GUI and to ...
1
vote
1answer
33 views

How do I optionally specify parameters in Powershell?

I'm porting some old code from AutoHotkey 'for laughs' and think I've stumbled across an unintended feature it had... I'm wanting to be able to do something 'like' $ws = "Minimized" $...
0
votes
1answer
100 views

Query Windows Update via MDM Update CSP

I'm trying to query accurate Windows Update information on Windows 10 Using the old "Microsoft.Update.Session" method, the data doesn't match what's in the Windows Update UI ("Settings&...
2
votes
1answer
60 views

Get-ADComputer with ANY filter not working (module loaded)

I have spent many hours on this and engaged a number of people I know to be PowerShell experts without any luck. It should be simple but it is definitely not working out that way this time. Objective: ...
0
votes
0answers
18 views

Cannot find FortiShield service via Get-Service, net start

I've recently installed the FortiNet client and wanted to see what the "fortishield" service is. The weird thing is, I'm able to stop it and start it, but I cannot see it in the output of ...
0
votes
1answer
42 views

DNS Server Search order in Windows 10 and VPNs

DNS queries to hosts accessible through a VPN fail. How to fix? On a Windows 10 host, DNS queries for hosts known only to the VPN-accessible DNS Server fail to resolve. The DNS queries are sent to my ...
1
vote
0answers
87 views

Powershell Script setting WMI CIMV2 Permissions

I am currently trying do change up a script so that I can put it into a GPO. The Script itself works but I want to do a "if else" around it. The Script is found here: https://gist.github.com/...
1
vote
1answer
55 views

How should i debug a Microsoft CIM that fails because MSFT_NetRoute be "not found"?

In general, how should one debug a failure related to CmdletizationQuery_NotFound messages, and why would the MSFT_NetRoute based queries register such an error? Details Specifically, my Kubernetes ...
0
votes
0answers
42 views

How to install modules for az cli in powershell?

I'm trying to install the module called az desktoprvirtualization in Azure CLI and I don't know how to install this extension module in Powershell. I want to know how to do that in Azure DevOps ...
2
votes
2answers
134 views

Export a list of VMs without a specific tag with PowerCLI

I'm trying to export a CSV file that has a list of all VM's in a cluster that don't have a specific tag that I'm using for rightsizing. However, the CSV isn't populating with anything other than this: ...

1
2 3 4 5
78