PowerShell is Microsoft's new scripting language in 2006, and significantly upgraded in 2009. It allows interpreted scripts based on PowerShell cmdlets and .NET primitives.

learn more… | top users | synonyms (1)

3
votes
1answer
618 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" ...
3
votes
3answers
215 views

Adding remote machine to AD via Powershell

So I have a powershell script, Add-Computer -ComputerName $computername -LocalCredential $computername\admin -DomainName $domain -Credential domain\$username -Force -Restart So if I have a machine ...
2
votes
1answer
97 views

How can I create a VPN connection inside windows image?

Just like we can add driver packages to a windows image file can one add a vpn connection preferably thru Add-VpnConnection inside a .wim file ?
0
votes
1answer
80 views

Powershell pipe exporting to csv is loosing data

I'm trying to write a script that will take input from a .txt file of IP address. Do a reverse DNS lookup to get the hostname of the IP address and then export that data into .csv file. Here is what ...
0
votes
1answer
489 views

Strange behavior from Invoke-WebRequest in scheduled task

I'm running a PowerShell script that posts data to an internal webserver over HTTPS. The SSL certificate is not valid. I'm using [System.Net.ServicePointManager]::ServerCertificateValidationCallback ...
1
vote
1answer
115 views

Error 0x8007007e When trying to mount WinPE 5 wim in Windows 7 using Powershell

Using ADK for Windows 8.1, and the DISM cmdlets that come with them. I have WMF 4.0 installed. My machine is Windows 7 x64 SP1, and I'm trying to mount the wim using PS C:\Users\BigHomie> ...
0
votes
0answers
250 views

Parameterizing powershell parameters in scheduled tasks

I have a bunch of powershell scripts that are kicked off via scheduled tasks at various times. The script are run multiple times with different arguments. Also admins unfamiliar with scripting needed ...
4
votes
2answers
97 views

How can I assign IPv6 addresses based on existing IPv4 addresses?

I have several hundred Server 2008 R2 machines with static IPv4 addresses. I'd like to enable IPv6 on each interface, and then automatically assign IPv6 addresses to them based on their existing IPv4 ...
0
votes
0answers
28 views

Run active directory logon script as an admin user [duplicate]

I have a logon (powershell)script for a certain non-admin user. The script retrieves some files from a server and places them in certain folders on the machine (and some other stuff as well). I don't ...
1
vote
1answer
82 views

How do I suppress “Yellow Text” from Exchange Set-Mailbox, when -WarningAction doesn't seem to work?

I am doing a bulk import, setting or updating attribute6 on 1,000 users in AD. I'm using the following Exchange commandlet to accomplish this: [PS] C:\>set-mailbox -Identity user@company.com ...
0
votes
1answer
70 views

MailboxExportRequest ContentFilter is “Received -ne $null” when querying by date

I am trying to export a mailbox to a PST. All email that was received before yesterday is what I am trying to export. $y = ((get-date).addDays(-1)).ToShortDateString() $exportRequest = ...
1
vote
1answer
56 views

Powershell runs all external commands in a new window, omitting output

As described in the subject, my powershell environment is executing all external commands in separate windows. In a typical test run of my team's build script, this includes things like: nuget.exe ...
1
vote
1answer
83 views

Difference between isntalling a msi using “Invoke-WmiMethod”(via a cmd file) and installing directly on the server

Ran against a server to install the msi; eventlogs were clean and all success; but the key file in bin direstory is still old. Later tried installing it directly doing a double click by RDP into the ...
5
votes
1answer
1k views

Powershell query lastlogondate (lastlogontimestamp) returning mostly blank values (not matching the ADSIedit value for corresponding user attribute)

I am running a very short script to simply print out all users and their last logon time: get-aduser -filter * -property * |ft name, lastlogondate I noticed only a small handful of users have a ...
5
votes
2answers
300 views

How to allow access to winrs for non-admin user?

I have Windows Server 2012 (and Server 2008, but it is next priority) to monitor it using txwinrm. txwinrm library internally is using WinRS protocol. I have to monitor it using least privileged user, ...
3
votes
2answers
242 views

Automatically reconfigure WinRM HTTPS listener with new certificate?

I am looking to enable WinRM HTTPS listeners on all of our servers for secure communication when using CredSSP between servers to get around the double-hop issue. Setting this up is fine, we have ...
6
votes
1answer
232 views

Evaluating current ACEs on NTFS ACLs with PowerShell

We have a document management system that has million of files on a NTFS file system accessed through a network share. A single service account needs full permission to all of these files and the ...
4
votes
6answers
430 views

Powershell assistance for Active Directory Cleanup

I just started a contract to clean up an Active Directory system for a large company. I was told it would be quite the busy work but after reviewing the system and seeing how disorganized and messy it ...
3
votes
2answers
102 views

Enumerate Windows DNS Server Zone attributes via shell

I'd like to use a command-line tool to list a (primary) zone's configured secondary servers, if any. Dnscmd comes close with: dnscmd server /ZoneResetSecondaries:[list of secondaries] But, I ...
1
vote
2answers
32 views

Debugging powershell init

My problem is that I just reinstalled my system and have installed heaps of packages via Chocolatey. However now when I launch powershell, something changes the fonst type and size inside the console ...
1
vote
0answers
99 views

Running New-RDSSessionDeployment Remotely

I'm trying to script the setup of a remote desktop deployment into Azure. I'm using Powershell remoting to connect to the WinRM endpoint on the VM's and execute remote Powershell. For the most part ...
0
votes
1answer
103 views

What rights should non-admin user have to run Get-WmiObject?

I am trying to monitor windows machine with the help of wmi and powershell remoting. I managed to successfully start remote session with that machine throught non-admin user account, but now I have a ...
3
votes
1answer
174 views

What is causing the Collateral damage when deleting old profiles?

#Get user names that have logged onto workstation $Users = gwmi win32_networkloginprofile | where {$_.name -match "EXP\\"} | where {$_.name -notmatch "srvtasksched"} $Users | foreach{ $Name = ...
6
votes
3answers
882 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 ...
2
votes
1answer
94 views

Windows 2008 Server R2 Command Prompt/Power Shell Slow Scrolling

I'm having an issue with various Windows 2008 Server R2 machines scrolling very slowly using the command line or Power Shell. For instance, if I type "dir", I see my contents being displayed 1 line at ...
3
votes
2answers
190 views

Best way to deploy Powershell 4.0 on Windows 7 sp1 and server 2008

I am planning to deploy powershell 4.0 on all Win 7 and server 2008 and 2008R2. I did some research about this, but couldn't find the official way to do it. I can just use batch file or GPO to ...
1
vote
1answer
179 views

Why is my Powershell script returing extra output when run by Nagios NRPE?

I have a Powershell script that I'm running via nrpe as an external script. The windows server (2008) is running nsclient++ (nscp.exe) v 0.4.1.102. The return section of my powershell script looks ...
0
votes
1answer
67 views

LocalGPO compare fails with error

I was trying to run LocalGPO on my Windows 7 system with its "/Compare" option to compare the current policies with that of a backup. However, the process fails with an error in a Windows Powershell ...
0
votes
0answers
253 views

“powershell has stopped working” on PS exit after creating IIS User

On a Windows Server 2012 box, I'm using PS to create a new IIS User (for automated deployments using MSDeploy). The command itself appears to work fine -- the user is created -- but as soon as I exit ...
1
vote
1answer
920 views

Installation of Windows Management Framework 4.0 (Powershell 4.0) on Server 2012 failed

I've been trying to test PowerShell Desired State configuration on a Windows Server 2012 instance on Amazon EC2. I downloaded the Windows Management Framework 4.0 from the MS download center: Windows ...
2
votes
3answers
2k views

GPO: Run powershell logon script after explorer.exe has been loaded

I know there is the GPO setting "Computer Configuration => Admin. Templates => System => Scripts => Run logon scripts synchronously". This however ensures that logon scripts run before windows ...
2
votes
1answer
64 views

how do i combine multiple powershell scripts in a guided install (for example with wix) but without the trail (ARP etc.)

I am working on a project where we need to repeat certain steps with powershell to deploy stuff. i would like to create a process/install guidance (steps supported with UI) with WIX but after the msi ...
1
vote
0answers
37 views

Remotely edit winrm conf file

Im trying to edit the winrm conf file on remote computer. I dont have the possibility to use GPO edit so i must find another way. I've tried to set the configurations that i need by using the "winrm ...
1
vote
1answer
121 views

What do the error messages and codes mean when creating and installing Managed Service Accounts?

When using the PowerShell Cmdlets for creating and installing Managed Service Accounts, certain errors can be thrown. What does each error mean?
1
vote
1answer
456 views

Modify IIS web.config using PowerShell

I'm trying to modify the web.config using PowerShell. So far, I'm able to replace the Connection String using: Set-WebConfigurationProperty -pspath "IIS:\Sites\$Name\WS" -filter ...
0
votes
1answer
97 views

Change an IISExpress site's physicalPath on the command line

What's the easiest way to accomplish this? I see there's lots of examples for appcmd relating to IIS proper, and using powershell for same, but I can't see an API of sorts for reconfiguring the ...
0
votes
0answers
34 views

ACL PS Script - hangs on 08 R2 PS v3; works fine on W8 PS v4

This script was designed to make application of permissions to a new server much easier. It is not doing that currently :( For some reason it works just fine on my Win 8 machine, where I made it. ...
-2
votes
1answer
804 views

How To List All Computers Operating System On A Network In Powershell

I am looking for a script to show all the machines, hostnames, and OS versions on my domain. I have found a few scripts, but none of the scripts that I have found will do both. Here is an example of ...
2
votes
1answer
224 views

Powershell: Piping input to Set-Acl

have a messed up folder with inconsistent ACLs which I need to uniform. I hoped to accomplish this with powershell. So I'm trying to search for all files missing the required group and applying the ...
1
vote
1answer
172 views

Nesting PowerShell DSC configurations from different files

If I nest DSC configurations in a single file like this, it works fine: Configuration Secondary { Param ($SomeParameter) Environment Test { Name = $SomeParameter Value = ...
0
votes
2answers
289 views

Powershell script can't open a file when run as a scheduled task

Cross-posting from Stack Overflow because there are probably many more Powershell experts on Server Fault. My Powershell (2.0) script has the following code snippet: $fileName = "c:\reports\1.xlsx" ...
2
votes
1answer
202 views

Can't shut down HyperV VM with Powershell despite admin rights

I am attempting to use a script that shuts down my Hyper-V VMs, copies their VHDs to a target share, then boots them back up. I found the script on spiceworks just a couple days ago. I always receive ...
0
votes
1answer
94 views

clean-mailboxdatabase error : unable to sync mailboxes with DS

Trying to run a script to clean exchange databases. When i run the clean-mailboxdatabase cmd-let I'm getting the following error: Exchange is unable to clean the database that you specified...Unable ...
2
votes
2answers
208 views

Powershell ForEach-Object : Cannot bind parameter

I am trying to get the owner of a process using this code: (Get-WmiObject -class win32_process | where{$_.ProcessName -eq 'explorer.exe'}).getowner() | Foreach-Object user | out-string This works ...
1
vote
2answers
648 views

powershell and using get-eventlog

I am trying to create a script that pulls failed log on attempts for certain events in the past 24 hours but I cant figure out how to pull the account information out. User is Null all the time so ...
0
votes
2answers
136 views

How to collect remote windows logs as a non-admin

I am trying to collect logs from remote windows machines (Windows Server 2008R2 and Windows 7) and I can't figure out a way to do so in such a way that I should still be able to accomplish this ...
8
votes
1answer
265 views

How to accept EULAs for Software updates deployed through SCCM using Powershell

I'm trying to use the Start-CMSoftwareUpdateDeployment cmdlet to deploy a software update group to an existing collection. PS WHO:\> Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName ...
0
votes
1answer
126 views

Auto-Tagging EC2 Instances in AWS (Windows Servers only)

I am looking for some guidance from the serverfault community. We are spinning up several new AWS instances (windows server 2008/2012) over the next few days. We have a naming convention in place for ...
0
votes
1answer
96 views

List current Principals in group Managed Service Accounts

Is there a way to list the current list of all the groups and/or hosts in the PrincipalsAllowedToRetrieveManagedPassword property of a gMSA (group Managed Service Account)? There isn't any help on ...
2
votes
1answer
177 views

Drainstopping NLB via powershell remotely

This question was asked by a colleague on SO here, though it was suggested that we ask it here instead - apologies for the cross posting. Server is Windows Server 2008 R2 - UAC is disabled on the ...