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, ...

learn more… | top users | synonyms (1)

0
votes
0answers
17 views

Powershell counting array elements that match a value

I have a script that builds a PSCustomObject with properties based on output from a DOS command. The array builds correctly and I can inspect it by dumping it to the screen output. However, when I try ...
0
votes
1answer
25 views

Azure Resource Manager storage - can I delete a VHD file using PowerShell?

I've recently been learning Azure Resource Manager template based deployment, and as a result I am deploying and removing a lot of VMs as I refine my ResourceManager templates. I have made a ...
1
vote
1answer
16 views

Powershell command to check for admin rights is always giving me false when i RDP into it and true when i use WinRM

I am trying to check my remote windows server 2012 R2 machines for admin rights to the current user via Ansible scripts. I found the following command to check for admin rights on the internet: ([...
5
votes
1answer
3k views

Why am I getting unauthorized errors with Powershell get-winevent?

I'm a domain admin equivalent, I've tried running in an elevated console (right-click> run as administrator), and I'm consistently getting errors when executing get-winevent -logname application | ...
1
vote
1answer
8k views

How to change all users Ad Email contact using powershell

I need a script that will change all of my ad users email contact field information. The format will be the "SAMAccountName + @domain.com". I am a powershell noob and need a little help on the syntax. ...
0
votes
0answers
7 views

Performance Issues for Excel Relinking in Powershell

We are doing a shared network drive reorganization. This will break links in hundreds of gigs of Excel files that the business uses. In order to soften the blow, I've created a Powershell script that ...
0
votes
1answer
23 views

powershell: Remove-DhcpServerv4Lease does not remove existing leases

I want to delete all DHCP leases and reservation from server WSKELLER. From the documentation I seem to understand that this would be accomplished with: Get-DhcpServerv4Scope -ComputerName WSKELLER | ...
0
votes
1answer
21 views

Powershell privileges and execution policy

Before shut this down please note its not a code issue, but an environment, privileges and policy issue on how do we enable this across the landscape. We are creating VHDs on regular basis, servers ...
4
votes
3answers
10k views

How to check if an AD username is already used

Thank you in advance for your help. I found something related at the following link but was unable to find the solution I was looking for through here. Check existance of domain accounts with ...
1
vote
1answer
35 views

PowerShell DSC +IIS Shared Configuration

I'm trying to set up TFS Release management to deploy to an IIS server that is set up for shared configuration. However, when the deploy is actually run, I get the following error: ##[debug]System....
0
votes
2answers
34 views

Invoke-DscResource against a resource without a module

On the current version of WMF5, I try and invoke a DSC resource using Invoke-DSCResource like so: $destinationPath="$env:SystemDrive\DirectAccess.txt" $fileContents="This file is create by Invoke-...
0
votes
1answer
4k views

Automatic alert/notification of calendar items added to Public Folders

We currently use Public Folders with Exchange 2010. We have a series of shared calendars throughout the organization. Some of the items posted require us to set up devices (video conferencing for ...
1
vote
1answer
25 views

Powershell find orphaned processes

I am looking for a way to find processes that do not have a parent process running (orphaned processes). Im attempting to do this using win32_process. I have the query that returns the attributes ...
0
votes
0answers
11 views

MSSQL configuration by PowerShell - What am I missing?

I want to configure certain MSSQL server settings using PowerShell scripts. (OS is Windows Server 2012 R2, MSSQL is 2014. PowerShell was invoked as sqlps.) For instance, I want to enable/disable a ...
4
votes
3answers
28k views

Grant MODIFY on “All Subfolders and Files” with icacls, but only give Read to top level folder

One of our Windows servers that has some user folders on it has some pretty screwed up permissions. What I want it for SYSTEM and Domain Admins to have full control of all folders. I want the users to ...
0
votes
1answer
30 views

How to update machineConfig64 .Net Framework-configuration provider

I'm trying to synchronize an IIS Site from an old Windows Server 2008 R2 with IIS7.5 to a new Windows Server 2012 R2 with IIS8.5. I'm doing that with the WDeploySnapin3.0 PowerShell Snapin now I got ...
-1
votes
0answers
16 views

What are some techniques for reorganizing a file structure in a business? [duplicate]

At work I have gotten tired of how disorganized our shared drive is. I've determined the best way to reorganize everything would be to mimic the directory structure based on our organization chart. ...
-1
votes
1answer
27 views

PowerShell: Getting a “does not support user interaction” error when no input is required

I'm running a PowerShell script during a TFS 2015-based deployment. It won't run because PS thinks it needs user interaction, but, when I copy-and-paste the command and arguments into the PS console ...
1
vote
2answers
2k views

Importing NTFSSecurity module from UNC path fails

I've created a central repository for Powershell modules, but I'm having trouble loading one in particular. The NTFSSecurity module is failing to import with the following message. PS Z:\> Import-...
0
votes
2answers
90 views

Get-AzureStorageAccount is not returning premium accounts (only standard accounts)

Does anyone know why the Azure PowerShell cmdlet Get-AzureStorageAccount only returns standard storage accounts? I have two standard and two premium storage accounts in my one Azure subscription, and ...
0
votes
1answer
21 views

How do I wait on a start/stop of a virtual machine in powershell

I have this powershell script that I'm calling to backup our customer's virtual machines: # Author: Vladimir Eremin # Created Date: 3/24/2015 # http://forums.veeam.com/member31097.html # ###########...
2
votes
1answer
28 views

Trouble using powershell output as a variable in batch file

I can manually run this command from a Windows Command Prompt: powershell (new-timespan -start 01/01/2000 -end (get-date)).days % 14 And it returns a number from 0 to 13. I want to use this result ...
1
vote
1answer
32 views

Is there a way to check if my Virtual Memory Paging is “System Managed”

For one of our applications, we need to configure virtual memory on a Windows Machine to be system Managed. This can be done manually under System Properties -> Performance (Settings...) -> ...
1
vote
2answers
1k views

PowerShell filter files by date in name

I have many files with different names per day. How can I filter them by the date in their name? For example: app_20130505.log app_20130506.log app_20130507.log app_20130508.log app_20130509.log ...
1
vote
1answer
31 views

How can I change owner of a Registry Key to which I don't have access?

I ran into a bizarre issue when I upgraded some machines to Windows 10 where incorrect permissions on RuntimeBroker caused problems. I found a solution online that recommended changing permissions (...
3
votes
1answer
12k views

List ALL Printers using Powershell

I'm having issues listing all the printers on a computer using Powershell. We have a batch script that will add/remove/list "per computer" printers using PrintUI. I can use PrintUI to list the ...
9
votes
4answers
84k views

List All Groups and Their Members with PowerShell on Win2008r2

I am new to powershell, but I've been reading manuals and practiced a little bit. My objective is to List all users in all Security Groups under specified path. I have found the way to do it: get-...
3
votes
2answers
38 views

Mimic delegation of control wizard with PowerShell

I want to delegate control of the TestUsers organizational unit to a user NickA and give the following permissions to it: Create, delete, and manage user accounts Reset user passwords and force ...
-3
votes
0answers
23 views

Can someone help me to have a powershell script to remove the “CRLF” text from the last line in a text file [duplicate]

Can someone help me to have a powershell script to remove the string "CRLF" text from the last line in a text file. I've asked my question incorrectly earlier
0
votes
1answer
32 views

How can I find the IIS server instance that a website is hosted on in my domain by only its public URL?

I have started a new job and inherited a lot of servers and websites. One particular website I am unsure of what server/IIS instance it is hosted on. All I know is the public URL of the site. Is ...
-2
votes
0answers
21 views

Have a windows 7 Task scheduled batch run as a regular-user johndoe which starts an exe on johndoe login, how to prevent his killing of process?

I am starting a script from Windows Task scheduler as a regular-user johndoe and my script starts an exe that runs in background when johndoe user logs in and I want to prevent user from "killing" the ...
0
votes
1answer
29 views

PowerShell script to create VM in 2012 R2 fails when adjusting memory size

I've created a basic script to quickly add a VM in Hyper-V and everything works great until it reaches the Set-VMMemory command. At this point the variables seem to fail and generate an error. Script ...
0
votes
1answer
2k views

Powershell execution policy within SQL Server

Can anyone help? Firstly I apologise if this is the wrong forum and for the amount of text you have to read. I'm not allowed to post images yet and a picture is worth a thousand words..... When ...
0
votes
2answers
44 views

Error while emailing CPU and Memory Utilization from a Windows Server

i can generate CPU and Memory Utilization of my laptop and email them to my email address. When i try to do the same thing for a Windows Server 2008, i get "new-object cannot load com type outlook....
0
votes
1answer
4k views

How to save event logs “Network Policy and Access Services” on NPS server

We have a Windows Server 2008 R2 Enterprise server with NPS role installed in it. (We dont use NAP). Is there any way, we can save all the event logs in------ Event Viewer -> Custom Views -> ...
2
votes
3answers
3k views

Powershell Start-process -Argument list not working

Start-Transcript c:\scripts\InstallUpdates.log -Append # -NoClobber $SourceMSUFiles = (get-content install-list.txt | where {$_ -like "*.msu"}) #Install MSU files foreach($file in $SourceMSUFiles) { ...
-2
votes
2answers
38 views

powershell script to find files not modified in the last 60 days Windows 2012 R2 [closed]

I'm trying to find files not modified in the last 60 days on a Windows 2012 R2 server. The built-in search ability in Windows doesn't offer this ability and I have installed the Windows Search ...
9
votes
1answer
599 views

How to persist credentials in a remote Powershell session?

I have an Azure File Share and would like to use this from my Azure VMs - after persisting the credentials on the VMs with cmdkey and mounting with net use. This was tested by running these commands ...
4
votes
1answer
46 views

Copy a Windows Server Firewall address list from one rule to another using Powershell

I'm a little stuck on the documentation for the Firewall cmdlets in Windows server. I am trying to copy the address lists for the remote and local ips from one rule to another. I can get the list ...
3
votes
1answer
28 views

How to use AuthenticationInfo in xWebApplication DSC resource

I have the following in my DSC configuration: xWebApplication StaffDirectoryApp { Website = "MySite" Name = "MyApp" WebAppPool = "MyPool" ...
0
votes
1answer
225 views

Script removal of Insider Hub app-Win10

I'd like to script the removal of the Windows 10 Insider Hub app. I've had no success with Powershell-admin: get-appxpackage -allusers -name *insider* | remove-appxpackage I can do it manually in the ...
4
votes
3answers
9k views

Use Powershell to find out what uses lots of memory (on 64 bit Windows)

How do I find out (in Powershell) what process/whatever uses the most memory? Edit: I am trying to figure out how to use Powershell to find out what's using all the physical memory in case Task ...
0
votes
2answers
1k views

“Maximum number of items that can be serialized or deserialized in an object graph” when executing GetMsolUser -All

I have an office 365 tenant on which I execute the following command Get-MsolUser -All on server A I get get-msoluser : The formatter threw an exception while trying to deserialize the message: ...
5
votes
2answers
2k views

Exchange's New-MailboxExportRequest behaves strangely with DateTime parameters to ContentFilter

I am attempting to extract a certain date-range of emails from a mailbox into a PST, but using a DateTime parameter for ContentFilter doesn't seem to work as expected. This should export everything ...
1
vote
1answer
1k views

Obtain device driver version and associated GUID using PowerShell?

Right now, I am getting two separate objects A Win32_NetworkAdapter WMI object A Win32_PnpSignedDriver WMI object In my previous scripts, I've made sure I was calling separate objects, and ...
6
votes
2answers
2k views

Changing physical path on IIS through appcmd isn't activated

We have come across an issue on IIS 7.5 where we have a simple deploy system which consists of the following: Create a zip-file of new webroot, consisting of three folders: Api Site Manager This ...
1
vote
2answers
204 views

Is there a way to get the cmdlet for data deduplication when running an Unoptimization job?

I deactivated data deduplication on one of my drives because it doesn't work well with the backup system. I then started an unoptimization job in Administrative PowerShell. After that I realized I ...
1
vote
1answer
31 views

Download a file with powershell on Nano Server?

I've had some significant difficulties figuring out how exactly to download a file with PowerShell under Nano Server. The challenge is the following: There is no Invoke-WebRequest There is no ...
0
votes
0answers
18 views

WMI query returns “Generic Failure” exception for certain classes

I am trying to query Win32_USBHub or Win32_DiskDrive on a remote server using PowerShell, but I am receiving the following error: [PS]> Get-WmiObject -Class "Win32_USBHub" -ComputerName MyServer -...
13
votes
4answers
45k views

Gaining administrator privileges in PowerShell

I only have one account on my Windows Vista machine, and that user has administrative privileges. However, when I try to execute a command within PowerShell to kill a certain process, I'm greeted with ...