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)

1
vote
1answer
1k views

Resetting the VMware PowerCLI global:DefaultVIServer and global:DefaultVIServers system variables?

Can anyone here please assist me in resetting the global:DefaultVIServer and global:DefaultVIServers system variables into $null ? because I cannot do anything with my PowerShell anymore even after ...
2
votes
2answers
3k views

How do I “catch” a failed command that doesn't work with try…catch?

I'm running the following script that fails for a mailbox that doesn't exist Set-MailboxDatabase rdb16 -AllowFileRestore:$true Mount-Database rdb16 $stats = Get-MailboxStatistics -Database rdb16 ...
0
votes
1answer
619 views

Reconnecting to a Mapped Drive after Server Restart from within PowerShell Script

I have a PowerShell v1 script that connects to a remote server via a mapped drive and moves files back and forth the remote server is identified by drive number "M" and also by UNC path REMOTESERVER\...
0
votes
1answer
424 views

AppFabric 1.1 on Server 2012 Dashboard Powershell - PSCustomObject

I have installed AppFabric onto Windows Server 2012. I checked the prerequisites were installed first and have installed accumulative update 3. I have an instance of SQL Server 2012 installed to SP1 ...
0
votes
1answer
1k views

Restart a service, and its dependents remotely in Windows

Normally after running Windows updates there are a few servers in our infrastructure that our monitoring software (SolarWinds) shows as having problems. Normally this is flagged as being the netman ...
0
votes
1answer
281 views

How to get process not responding on remote server with Powershell

I don't understand, responding is empty on remote serveur. Get-Process explorer -ComputerName vcass1 | select name,id,responding Name Id Responding ---- ...
2
votes
1answer
2k views

PowerShell - Combining Sort-Object to list of piped commands

I need to process files in order from oldest create date to newest. I found the sort-object command which is what I need however I don't have a clue how to add it to my ForEach() statement. Can ...
2
votes
1answer
5k views

PowerShell PSCredential Argument List - Path

I need to connect to a remote server and do some file copies and moves, etc. The remote server requires authentication. What do I need to enter in for PSCredential -ArgumentList, argument #1? Is it ...
5
votes
1answer
766 views

Is there a cmd/certutils to copy a certificate from one store to another?

I would like to know if there is a cmd to copy an existing certificate from one store to another. I am trying to copy a certificate from the Users Intermediate Certification Authorities store (...
1
vote
2answers
564 views

PowerShell v1 Move-Item not Moving items

I have a script (pasted below) that's supposed to do the following: Loops and grabs all files that match a defined pattern Copies those files into another location Move the original source file into ...
1
vote
1answer
884 views

PowerShell Copy-Item Method Fails

I am trying to use PowerShell (v.1) to copy over only files that match a pattern. The file naming convention is: Daily_Reviews[0001-0871].journal Daily_Reviews[1002-9887].journal [...] When I run ...
1
vote
2answers
179 views

Pattern Matching with PowerShell 1

All, I am new to Windows admin-type stuff but I am familiar with Unix/Linux, etc. I have a simple PowerShell 1 script that should only copy files that match this naming convention: Daily_Reviews[...
2
votes
2answers
9k views

Using Powershell to bulk change the Home folder path of AD objects - %username"?

I have done a lot of searching on this, and still cannot find the answer. I have created a script which will bulk move all user objects in one OU to another OU. This works fine. Now I am trying to ...
2
votes
1answer
3k views

Powershell: Understanding Printer DACLs

I'm attempting to read and eventually write the DACLs for printers shared from my print server. Here's what I have so far, based on scripts found around the internet: $pace = DATA { ...
5
votes
1answer
6k views

How do I run commands on a remote machine with admin privilege using powershell

How do I run commands on a remote machine with admin privilege (example: running as Run as Administrator) using PowerShell. So far I have tried start-process powershell.exe -verb runas -...
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
1answer
3k views

The value of property “UserPrincipalName” is used by another recipient object

I'm stuck in some sort of strange loop. I tried to create an office 365 user, and did not have any available licenses. I followed the link to purchase an additional license, then went back and ...
2
votes
1answer
50 views

Alternative for Obsolete -VhdDestinationPath Parameter

I am trying to import a virtual machine with PowerShell and I want to specify which folder the VHD file should be placed in. According to http://technet.microsoft.com/en-us/library/hh848495.aspx the -...
-1
votes
1answer
294 views

Some regex for powershell [closed]

I have below sample file(s). Symmetrix logical device count=13 CLARiiON logical device count=0 Invista logical device count=0 Generic logical device count=0 ==========================================...
0
votes
0answers
604 views

PowerShell doesn't like the -AssignDriveLetter option of the New-Partition cmdlet

I'm trying to create a partition on the USB flash drive using the New-Partition cmdlet. But when I use the -AssignDriveLetter option I get "New-Partition : Invalid Parameter" even though this option ...
1
vote
0answers
752 views

Cannot create partition on disk using PowerShell: “New-Partition : Not enough available capacity”

I'm trying to create two partition on the USB flash drive. The first small 350Mb partition is created fine, but the second throws "New-Partition : Not enough available capacity" even though there is a ...
1
vote
0answers
650 views

Cannot initialize disk in PowerShell : Initialize-Disk throws “The disk has already been initialized”

I'm trying to change the flash drive's partition style to GPT using PowerShell, but the cmdlet throws "The disk has already been initialized" (even though I've cleaned the drive): PS C:\WINDOWS\...
4
votes
3answers
4k views

Export Windows Server configuration to powershell script?

I'm looking for a way to export role/feature configuration to a scriptfile, like powershell. Lets say you've installed the DHCP-Role. You configure the scopes, reservations and all that stuff you ...
5
votes
2answers
2k views

Why can a Domain Admin run a powershell cmd locally, but connecting over WinRM with the same account, command returns an UnauthorizedAccessException?

I'm trying to administer a Windows 7 machine remotely. I've enabled WinRM and can use Enter-PsSession to connect to the remote machine. However, I'm noticing a difference between running a particular ...
0
votes
1answer
295 views

Windows: Remote Display Back in Powershell a la X11?

If I have two Linux boxes, A and B, I can SSH from A to B with X11 forwarding enabled. This allows me to use graphical applications on B and have the display rendered on Machine A. Is there a way to ...
4
votes
1answer
907 views

PowerShell: Copy-GPO failing with HRESULT: 0x8007000D

While trying to run the Copy-GPO cmdlet to copy a Group Policy Object using a predefined Migration Table I am receiving this exception: System.Runtime.InteropServices.COMException (0x8007000D): The ...
1
vote
1answer
510 views

Batch rename files using PowerShell or other

I have a folder of images taken on two different mobile phones. The two phones use slightly different file name formats. I want to change one of them to match the other so I have a neat photo album. ...
1
vote
1answer
603 views

Running SSH command within a scheduled task

I have simple powershell script which gets the offset of a Ubuntu server with the time of the NTP server. The command I run is $result = ssh -i C:\temp\privatekey domain\username@servername "...
2
votes
1answer
784 views

Powershell V1 v V3 - Pop-Up windows gone

When I did $name = Read-Host 'What is your name?' in Powershell V1 it would ask the question in a pop-up window. With Powershell V3 it just asks in the console window. Is there a way to force Read-...
2
votes
1answer
677 views

Powershell - how to Start-Job with an ActiveDirectory credential

My client controls access to their database with ActiveDirectory. I would like to do the following: $cred = Get-Credential Start-Job -Credential $cred { #do some stuff with the db } This works ...
0
votes
1answer
1k views

Need equivalent of command with nmap, awk and grep for Windows machines with PowerShell and/or Perl

Please see this thread for reference How can I scan using nmap and Zenmap all hostnames that begin with a particular string? One of the answers in the thread above uses the following query (I take ...
2
votes
1answer
262 views

How can I merge the output of two amost identical powershell commands?

I'm monitoring the counnection count for each of my CAS servers and would like to concatenate the output of each of them so I can display it cleanly. I've tried "adding" the results as in $rpc = $rpc ...
1
vote
1answer
159 views

Automating windows server 2008 installation in hyper V with powershell

I often set up servers in Hyper V on my laptop (running windows server 2008) to test varoius software. Is there a way in powershell to build an image in Hyper V and run windows update on that image? ...
2
votes
2answers
1k views

I need to list all users in Active Directory that do not have any data in the NAME field, using PowerShell

I need to list of all users in AD that do not have any entry in the NAME field (example: smith,jon) So far I have something like below Get-ADUser -filter {Name -eq " "} | FT SamAccountName I know ...
5
votes
1answer
2k views

Exchange 2010 Auto-mapping mailboxes feature doesn't work when groups grant permissions

I have a shared mailbox that I need to deploy to one of our departments in an Exchange 2010 SP2 environment with Outlook 2010 clients. I'm trying to rely on the auto-mapping feature introduced by ...
1
vote
2answers
7k views

How to rename bunch of users' DisplayNames using Powershell in Exchange 2010?

I have bunch of users which DisplayNames I changed mistakenly to some string (for example: xyz) But there is one field called Name which has FirstName and Lastname. What I want is take all users who ...
1
vote
1answer
1k views

Script to Uninstall MS Updates by Date

I'm in a situation where I need to uninstall all windows updates before a certain date to troubleshoot a strange bug. I found several vb/ps scripts to do this remove single update However I'm ...
1
vote
1answer
1k views

SCCM 2007 Powershell “Update Collection Membership”

Is there Powershell command/script that can be setup to run an "update collection memebership" on a specific collection and subcollections? If not Powershell another way besides right click on ...
3
votes
1answer
669 views

Systems Center service template including AD

I'm trying to design an SCVMM (2012 SP1) service template that contains several machines joined in a domain, but the trick is that the very domain controller is also in the template. Ie. the template ...
6
votes
3answers
6k views

How to get a list of emails older than 2 years in Exchange Database, sorted by user, using Powershell?

We are currently looking at archiving emails and revamping our retention policy. The big question is (for the legal department), how far back do we want to save? Currently our users have a huge ...
6
votes
1answer
11k views

Rename displayName and CN from givenName and surName with Powershell?

I need to reconcile the displayName and CN attributes to the givenName and surName fields in AD. Is it possible to take givenName and surName and rename both the displayName and CN using Powershell?
0
votes
1answer
330 views

Hyper-V and Windows Server with Powershell/Automated?

So my work is looking into Automating Hyper-V Servers for Test Environments, Basically in the end we want to have a sort of Web/Form interface for selecting a server spin up. Right now it's done ...
1
vote
1answer
288 views

PowerShell: replacing AD DS ACLs

I am looking for a code sample showing how a permission set on a given Active Directory object (in my case an Organizational Unit) could be modified in a way where permissions for a given security ...
4
votes
1answer
3k views

Powershell remoting to a server using CNAME, not COMPUTER NAME

I am trying to get powershell remoting to work with a server using it's CNAME rather than the computer name. Both local and remote machines are on the same network and domain. I have enabled ...
2
votes
1answer
110 views

How Can I Source My $Profile From A Powershell Function?

I like to make a lot of changes to my $profile file. After saving a change, I would like to source the file using an "sop" alias. Here's how I hope to accomplish that: set-alias sop Source-Profile ...
1
vote
1answer
118 views

Is Microsoft .NET Framework Client Profile enough for PowerShell to work on a Windows XP workstation?

Is Microsoft .NET Framework Client Profile enough for PowerShell to work on a Windows XP workstation? Or is a full .NET version needed to be installed? Are there any advantages for the full ...
0
votes
1answer
4k views

Remotely execute application on another PC connected via a crossover cable

I have two PCs that are both running Windows XP SP3, referred to as PC1 and PC2. They are connected to each other through cross-over ethernet cable. PC1 has the static IP address 10.0.0.1 and PC2 has ...
3
votes
1answer
286 views

How can I add a user's domain information to the pipeline in PowerShell when using Get-ADUser?

I'm trying to enumerate the name, samaccountname, and domain that each user in my forest belongs to and write it to a text file. The script that I have now is: Import-Module ActiveDirectory $...
1
vote
1answer
902 views

Access Denied when creating a scheduled task with powershell and the com schedule.service object

I have a powershell script that creates a scheduled task using a call to RegisterTask via the Schedule.Service com object. Essentially: $ts = new-object -com Schedule.Service $ts.Connect() $...
0
votes
1answer
1k views

Powershell script to insert SQL Statement with a apostrophe error

I have the following part of a script that takes objects form Exchange and AD and inserts into a MYSQL table. But some of the Full Names variables have a ' like the distribution group PA's. Here's ...