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)

2
votes
1answer
24 views

Windows Desired State Configuration / DSC: Is there a simple, “flat” way to use them?

The articles all discuss staging, packaging and a bunch of infrastructure aspects. Is it possible to just run the scripts, either locally, or (preferable!) against a remote server? E.g. ...
0
votes
0answers
13 views

How to run mysql prompt in windows powershell ISE?

I want to use PowerShell ISE tab to be able to connect mysql client and tun sql statements, however as soon as I connect to client using following command - >mysql.exe ...
0
votes
1answer
36 views

Editing XML files from powershell

I have this XML file below which I need to edit. <?xml version="1.0"?> <rdwastr:strings xmlns:rdwastr="urn:microsoft.com:rdwastrings"> <string id="PageTitle">RD Web ...
0
votes
1answer
18 views

How to start multiple Azure VM at the same time?

I'm trying to use Powershell scripts to start multiple VMs at the same time. I only know how to start one single VM or all VMs at the same time, but in my case, I only want to make change to selected ...
0
votes
0answers
15 views

PowerCLI Move-VM Returns failure but vm still moves

I have a script that is moving VM's from one datastore to another. I have other logic to protect the Storage backend and fabric from over subscription and to wait to submit new requests at specific ...
1
vote
2answers
931 views

Start-BitsTransfer Works when triggered manually from powershell but not using a windows service

I'm using BITS to transfer file from one windows 2008 R2 server to the other. When I run the command manually from powershell or regular command line it works perfectly. Now when I use the same ...
3
votes
1answer
387 views

How can I create Organizational Units recursively on Powershell?

I'm writing a Powershell script to populate all the company users to a Active Directory from a CSV file. The script uses the Powershell command New-ADUser and it should know, for every user, where is ...
0
votes
1answer
19 views

Is it possible to execute Azure automation runbook on Visual Studio?

I am considering about two cases. One is edit runbooks on Visual Studio, then execute them to perform Automation task directly. Another one is that edit runbooks on Visual Studio, then I use ...
0
votes
3answers
7k views

Office 365 Powershell - Export user, license type, and company field to csv file

I need to be able to export user name or email address (doesn't matter which), company (from the company field under the organization tab in a user account of the exchange admin console), and license ...
1
vote
1answer
26 views

Can I execute Azure Automation Runbook on PowerShell?

Actually I want to run these runbooks by myself, not relying on Automation Part. In this case, I can choose when to deploy them, and also it is flexible for me to choose variables. It would be better ...
-7
votes
0answers
39 views

How can I loop my Powershell script? [migrated]

How can I loop my powershel script? It copies the local NTUSER.DAT to the file server, I understand that the local NTUSER.DAT file may be locked by the operating system so my COPY may fail. I need it ...
2
votes
1answer
31 views

Powershell Array search for keys

I Have an array called $a echo $a gives: url load --- ...
4
votes
3answers
1k views

How to find last login user on given computer name on AD

If anyone could help, it would be appreciated. I am trying to audit the network. I have list of computers that are active in last 3 months in domain. I have little script that run when user login to ...
4
votes
1answer
41 views

Powershell - Merging Results in one table

I am new to powershell. I am trying to create a report that shows AD accounts that expire soon. The report should include the User Name, AccountExpirationDate and the Manager. I have the ...
1
vote
0answers
22 views

How do I script a change to the msmq storage location on Windows 2008 R2 server

Is there any way of doing this through a batch or powershell script? I'm looking for a way to set up several new servers. The only thing I found on the subject leads me to believe you cannot: from ...
2
votes
1answer
29 views

How to Automatically Tust Auto Enrolled Code Signing Certificates

In my organization all developers are setup to be granted a Code signing certificate via Auto Enrollment. Additionally, PowerShell is configured by group policy to require all scripts to be signed. ...
7
votes
2answers
84 views

What's the difference between Remove-WindowsFeature and Uninstall-WindowsFeature?

What's the difference between Remove-WindowsFeature and Uninstall-WindowsFeature? I've used Add- and Remove- on Windows 2008 R2 boxes, but there is now an Install- and Uninstall- which according to ...
1
vote
1answer
77 views

Powershell sort-object, csv

I got two *.csv files. The first contains this IP, MAC, Name, Comment 10.10.122.1, 66-55-44-33-22-11, testuser1, this is testuser 1 10.10.122.100, 66-55-44-33-22-12, testuser2, this is testuser 2 ...
7
votes
2answers
65 views

Enable Certificate Enrollment Policy and Request a Cert using PowerShell

Right now, I'm doing the following to request a cert from a CEP server: Open gpedit.msc Under Computer Configuration > Windows Settings > Security Settings > Public Key Policies, double click ...
3
votes
1answer
55 views

Find Full or Differential backup from .bak (with powershell or by any other means)

I'm trying to determine whether an MS SQL backup file (.bak) is Full or Differential. Is there an easy way to do this? A way of doing this in powershell?
1
vote
1answer
31 views

How can I speed up PowerShell cmdlets that are using the -CimSession parameter?

As the title says, how could someone speed up the execution of this tiny script? Am I using the New-CimSession that right way anyway? $computers = Get-ADComputer -SearchBase ...
1
vote
1answer
24 views

How do I find the mailbox name for an exchange 2010 account so I can connect using mapi

I was redirected here from Stack Overflow, so my apologies if this happens to be off topic. I have an issue at the moment where I am trying to set up a connection between my exchange account and a ...
0
votes
1answer
526 views

Cluster Aware Updating set up - VirtualComputerObjectName ignored

I am trying to set up Cluster Aware Updating, but it always fails with the following error: Add-CauClusterRole : Unable to create the CAU clustered role because a Network Name resource could not be ...
1
vote
1answer
32 views

Deleted GAL in EMC and ADSIEDIT now Error

I attempted to delete a Global Address List via Exchange Management Console and ADSIEDIT as I made a typo during the creation. Now when I try to create a new GAL, i get the following error [PS] ...
2
votes
1answer
143 views

add certificate to all files in EFS-folder with script

I try to set up collective access to EFS-folder. I want to add certificates of all users to all files in folder. Is it posible do with using powershell scripts or some another way? Thanks.
8
votes
4answers
146 views

Test-Cluster Powershell cmdlet List vs Validate

The Powershell cmdlet Test-Cluster queries a myriad of data and performs validation tests which it wraps into a pretty report. If you run Test-Cluster -List you get a list of item's you can ...
2
votes
1answer
132 views

Using Powershell to update users home directory

I am trying to change the home directory path to a bunch of users. I wrote a script in Ppowershell which should change the path the username like so: \\serverName\shareName\$_.SamAccountName The ...
2
votes
2answers
4k views

How can I reset settings for Internet Explorer using a script?

I'm looking to reset Internet Explorer back to factory defaults using a batch file. I'd also like to delete: all Downloads, History, Cookies and Cache, plus anything else in a user's IE profile.
1
vote
0answers
10 views

Does Stop-CauRun Stop the Current Server or the Whole CAU action?

When using a PreUpdateScript or PostUpdateScript with "Windows Cluster Aware Updating" and "Updating Run Profiles" would calling the cmdlet Stop-CauRun do any of the following: Would it actually ...
4
votes
3answers
8k views

Why does my PowerShell script hang when called in PSEXEC via a batch (.cmd) file?

I'm trying to remotely execute a PowerShell script using PSEXEC. The PowerShell script is called via a .cmd batch file. The reason we do this is to change the execution policy, run the powershell ...
3
votes
1answer
2k views

Script to export custom view Event Viewer to .evtx Powershell

This is my PowerShell script to export data from a Custom View in the Event Viewer via the XML data. set-executionpolicy unrestricted [xml]$CustomView = @" <QueryList> <Query Id="0" ...
1
vote
4answers
138 views

powershell check windows update on a server

We have some 1000 + servers, we are doing monthly patching activity. i need to check the patches are updated on the servers or not, is it possible to check based on the Microsoft Security Bulletin ...
0
votes
0answers
19 views

List mapped zombie drives in powershell

I'm writing a little powershell script for some basic logs that have to be generated. Right now I'm stuck with logging mapped network drives: $colDrives = Get-WmiObject Win32_MappedLogicalDisk ...
2
votes
0answers
38 views

How to retrieve a MDT task sequence variable and use it properly inside Powershell

I'm trying to retrieve a MDT task sequence variable inside a Powershell script, then use that variable in a Powershell function. My problem lies in that the variable I want to retrieve contains a ...
1
vote
1answer
18 views

How do I take an eml file and place it in the inbox for journaling, without sending the email?

I have an archiving system that reads both envelope and legacy journaling messages in an Exchange 2010 environment. The journaling target is simply a mailbox that receives a copy of every SMTP ...
37
votes
22answers
14k views

PowerShell? Do you use it? Can you show me some cool system administration things I can do with it? [closed]

I keep reading everywhere that PowerShell is the way of the future. When it was first released I did a whole bunch of virtual labs, but since then I still haven't used it in a production environment. ...
1
vote
0answers
26 views

Can not install Office 2010 via winrm

I am trying to install Microsoft Office 2010, I have created a MSP and config.xml file so I can do this from Powershell, using the following command: Start-Process "C:\temp\Office2010\x86\setup.exe" ...
3
votes
0answers
48 views

Batch script is not getting executed when called by Start-Process Cmdlet

I have a strange issue on a Windows Server 2012 R2 here that just does not make any sense to me at all. I've got a PowerShell script that basically has the following structure: Function ...
2
votes
1answer
956 views

SQL Server: How to report error from a job's step of PowerShell type

I have a SQL job whose step of 'PowerShell' type does 'exit 1' if encounters an error i.e. $ErrorActionPreference='stop'; trap{"$_"; exit 1} Problem is, SQL Server doesn't pay attention to that exit ...
1
vote
3answers
4k views

Cannot get Exchange PowerShell script to run under Scheduled Tasks

I have a PowerShell script that works when entered directly into the PowerShell. The PowerShell program is run with the shorcut: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ...
5
votes
2answers
306 views

Is there a way to tell how long a machine has been in an security group?

Machines get added to a security group to prevent them from getting a GPO. I'd like the machines to get removed after 30 days of being in the group. Ideally, I'd like to also be able to generate a ...
1
vote
5answers
4k views

Powershell unable to “see” dnscmd.exe

Am at a complete loss with this one. Recently a number of my powershell scripts have started failing as they are unable to find the command dnscmd.exe. What has me at a loss is that the executable ...
0
votes
0answers
44 views

Batch/Powershell file wont run via Task Scheduler during logoff

I'm having trouble getting my Powershell file to run from Task Schedule during logoff. In short, I'm trying to upload my NTUSER.DAT (roaming profile) to my profiles folder on the file server. Dynamic ...
6
votes
4answers
2k views

How to find the creation date of a local user account?

I would like to get the creation date of a local user account (Win 7 if it matters). I've looked at the following WMI objects (and google of course): Win32_UserAccount Win32_NetworkLoginProfile The ...
0
votes
0answers
22 views

Powershell and dsget do not return full results when querying group membership

I'm trying to get information about group membership of certain users. Ultimately I want to automate this in some way but I'm having difficulty extracting the information at all. The problem is that ...
0
votes
1answer
37 views

Powershell AD Group creation script

I am making an AD Group creation script New-ADGroup -Name "CS-WS-PROD-Admin" -GroupCategory Security -GroupScope Global -Path "$OU" -Description "Admin Rights on PROD" -ManagedBy CS-WS-SAR-ADMINS ...
0
votes
1answer
1k 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 -> ...
0
votes
0answers
19 views

Use Powershell to add items to Access Protection in McAfee Enterprise

I'm guessing this won't work for security reasons, but I thought I'd ask anyway. I'm trying to use powershell to send email notifications for maintenance. I've got the actual notifications and ...
1
vote
1answer
30 views

POWERSHELL: The term 'New-AcceptedDomain' is not recognized as the name of a cmdlet

I am trying to set-up a multi tenant exchange 2013 environment. Currently we have the 2013 environment in production and have a few companies using it. The drawback however is that each company can ...
0
votes
1answer
24 views

How can I use Powershell to add a site to my IIS or IISExpress server

Is it possible to add a site (and bindings) to my applicationHost.config file for IIS Express or IIS ? here's one I had to manually add (which works perfectly) ... <site name="Our Awesome ...