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
0answers
20 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 ...
0
votes
0answers
30 views

How to add-printerport correctly when adding printer from print server

I've been rambling around the question since a week now. I'd like to know if how to add a printer port correctly on a non-domain joined computer to make the print go through the print server queue. ...
0
votes
0answers
15 views

Timeouts / signal handling in MS Windows (Powershell or .NET)

In the world of Unix like OSes, you can finish tardy processes like this: my $timeout = 5; # seconds eval { local $SIG{ALRM} = sub { die "Sorry, timed out. Please try again\n" }; ...
0
votes
2answers
85 views

How to Find all Members of Windows Security Group in Powershell?

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 ...
0
votes
0answers
17 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....
0
votes
0answers
10 views

PowerShell Call Restore Point in Windows Beside Sequence ID

So I'm aware that using Restore-Computer -RestorePoint ID I can call a specific restore point in my script, where Windows will rollback to. My situation requires a different approach, which I've seen ...
0
votes
0answers
16 views

Powershell: print directly setting

I'm trying to set the printer settings to "Print directly to the printer" through Powershell. This because it tends to change back from time to time. I've managed to do this 2 days ago but ...
0
votes
0answers
14 views

PowerShell - Restoring Incremental SQL Backups from MABS (DPM)

I am a DBA trying to automate the restore process for databases backed up by Microsft Azure Backup Server. I am able to restore full backups, however, I cannot work out how to restore subsequent ...
0
votes
0answers
15 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 -...
0
votes
1answer
27 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 [...
0
votes
1answer
18 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 ...
0
votes
1answer
19 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:...
0
votes
1answer
38 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> <...
0
votes
1answer
23 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 ...
-1
votes
0answers
26 views

Local Security Policy and Powershell

So we have a local security policy hklm:software\policies\microsoft\windows\system -name cleanupProfiles and at this time it is enable. We want to make it "not configured" local After this ...
0
votes
0answers
28 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 ...
0
votes
0answers
22 views

Powershell script help to merge data [migrated]

Sorry, I'm not very good with powershell can anyone offer a solution please? There's a server with 20,000 folders each folder is a job number and inside each folder is many sub folders with .msg files....
0
votes
2answers
100 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-...
0
votes
1answer
38 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 ...
0
votes
0answers
34 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: ...
1
vote
0answers
19 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. ...
0
votes
0answers
23 views

How to ensure a zipped folder no longer contains a deleted file after it is unzipped to another folder?

I am new to Powershell and I am encountering a problem. I have two File Paths containing the two folders that I need to perform my Task. For example, folderA = D:\Deployment\Packages\FileA folderB= E:\...
0
votes
0answers
29 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 ...
0
votes
0answers
52 views

Powershell - Status "Installed(pending removal)" when running Remove-Appxpackage

I'm developing application uninstaller using Powershell. I using 2 commands: Uninstall for all users (using -AllUser): Get-AppxPackage -AllUsers <PackageName> | Remove-AppxPackage -AllUsers ...
-2
votes
1answer
52 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
28 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
52 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
51 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 ...
-3
votes
2answers
47 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
1answer
14 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
26 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
39 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
25 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
17 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
90 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
12 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
28 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
32 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
23 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
27 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
15 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
31 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
75 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
15 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
77 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
33 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
49 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 ...

1
2 3 4 5
78