For issues relating to Windows PowerShell, version 3.0.

learn more… | top users | synonyms

1
vote
2answers
72 views

Get-ADUser over multiple OUs and filter results

This script is supposed to grab users from several OUs and assign the users to one variable, then it takes the users from that variable and filters through each one based on last logon dates over 30 ...
-7
votes
1answer
140 views

SysWOW64 access denied (Windows Server 2012 Standard) [closed]

I am trying to call: [System.IO.File]::Delete($folder) from the Powershell ISE (not ISEx86). I am logged in as Domain User that is an Administrator on this machine to which I connect using RDP. I ...
0
votes
1answer
25 views

Printer Audit 64bit

I'm running the following script to get a report on installed printers : https://community.spiceworks.com/scripts/show/2186-export-printer-information-to-spreadsheet?page=1 However when the script ...
1
vote
1answer
70 views

Powershell, IIS Express, Server 2012, Microsoft.Web.Administration requires run as admin

I'm having a strange issue with Microsoft.Web.Adminstration 7.9.0.0 for IISExpress requiring run as administrator on Server 2012. What I'm trying to do is add a Website to a custom ApplicationHost....
0
votes
2answers
86 views

Powershell equivalent of Ctrl+R?

In bash I can do Ctrl+R and start typing a command to have it search my history. How do I do that in powershell? Is there a way to bind a key to something like function GH($str) {get-history | ...
0
votes
1answer
65 views

Difference between two powershell scripts

I received a script that is supposed to scan the event logs of 4 DCs, searching the event ID 4740 (user lockout). This is script number 1. Now I thought to myself, "Why scan all the DCs when I can ...
0
votes
1answer
51 views

My script does not go to the next server

I'm trying to retrieve eventlog (with certain conditions) from multiple servers. It only checks the first server and does not move onto the next one. What is wrong with it? I tried different scripts (...
0
votes
2answers
80 views

How to rename a non-AD computer remotely

I have the need to rename a non-ad computer that was just created with Hyper-V via Powershell scripts to a meaningful name before I connect it to the domain. I have the local username and password to ...
1
vote
0answers
68 views

NTFS Permission Report

Team, Can any one help me make the following changes to the script. what it does it perfect, but when it checks for permissions. it does not seem to be able to differentiate between ALLOW or DENY ...
0
votes
1answer
141 views

Powershell command for extracting all users from a domain

Get-ADUser -SearchBase "dc=contoso,dc=local" -filter * -properties Name, Surname, samAccountName, Enabled, PasswordNeverExpires, PasswordExpired, PasswordLastSet, MemberOf | Select Name, Surname, ...
0
votes
0answers
307 views

ExportedCommand empty custom module PowerShell

I have a custom module in Powershell. It consists of two files the Copy-Move.psm1 and the Copy-Move.psd1. In the Copy-Move.psm1 I have several functions from which I only export the function "Copy-...
4
votes
3answers
3k views

Find out if password expired or when it expires for user in a specific OU

Is there any powershell command that outputs the users that have their passwords expired from a specific organizational unit (OU). If so can it be combined in a script with another command that ...
4
votes
4answers
1k views

Script for getting last reboot timestamp (2008r2)

I have a list of ad-integrated computers and I need a list of them with their last reboot time. I found some comands like Get-WmiObject -ClassName win32_operatingsystem -ComputerName xxx | select ...
2
votes
1answer
625 views

Get AD Group Member - Different Domains

I've been tasked with exporting the members of a few AD groups to .csv which I've always done in the past using the Get-ADGroupMember command in powershell, specifying the group name, selecting the ...
2
votes
2answers
233 views

Powershell New-SMBShare not running as expected in script

I am working to move some files from one physical drive to another in large group of Windows 2012 servers. The drive letters and sizes are all the same on these servers. Basically we have a share on ...
0
votes
0answers
50 views

MSOnlineBackup cmdlet fails when using alternate server

I am using Windows Azure Backup to backup some data from an Azure VM. I have two machines, one where the backup is created, the other where it is recovered. I am trying to use the MSOnlineBackup ...
1
vote
1answer
164 views

New-ADGroup with Multiple -OtherAttributes?

Keep getting "The Paramater is Incorrect" I think im following microsofts method correctly but its not working, any help is greatly appriciated. New-ADGroup -DisplayName $name -...
0
votes
1answer
89 views

VBScript- Input DisplayName Output AD Username

If I had a txt file with a bunch of names: Dan Smith Jim Bob Ryan Jones etc,etc using a VBscript could I convert the displaynames to AD Usernames? If Powershell is only options, could you please ...
1
vote
1answer
38 views

Delete " from a file content

I am querying list of domain joined computers using powershell as below: dsquery.exe computer > "C:\testfolder\host.txt" Output is working as expected, but it is as shown below: "CN=WIN-...
2
votes
1answer
515 views

Version v4.0.30319 of the .NET Framework is not installed and it is required to run version 3 of Windows PowerShell

I have a server which we are using for Batch processing. I can login to the server with svc_account and run powershell -f file.ps1 and it runs fine in either version 2 or 3 by the following - ...
4
votes
2answers
2k views

How to filter the Windows Security event log by SID?

I want to filter the event log for a certain user, but I don't think there's an option to search by SAMID. There is a filter by UserId though, according to here. Is the following correct syntax ...
1
vote
2answers
1k views

powershell format a value that's already a string

I have some values that I want formatted in a specific way. To be very clear, its an IP address octet and I want it in a "xxx" format. For example if I have a octet value of "20" I want to display ...
0
votes
1answer
365 views

PowerShell - Server 2012 - Issue with Custom Modules Loading

I'm having a frustrating issue with our deployment script that is currently working on Server 2008 R2 and I can't get to start on Server 2012 due to issues with PS not recognizing our custom modules ...
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) { ...
0
votes
0answers
311 views

Invoke-GPUpdate fails even with firewall disabled

PS C:\Users\Administrator> Invoke-GPUpdate -Computer rim-23 Invoke-GPUpdate : Computer "rim-23" is not responding. The target computer is either turned off or Remote Scheduled Tasks Management ...
7
votes
2answers
3k 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 "...
-1
votes
1answer
118 views

Execute a git pull on a remote windows server [closed]

I'm trying to remotely execute a git pull on a Windows server via New-PSSession powershell script. Most git commands like status and help, but when I execute a pull command it just hangs and I confirm ...
6
votes
2answers
4k views

Invoke-Restmethod breaks script in PS 4.0

I had a Powershell script that used Invoke-RestMethod that was working in powershell 3.0. However, I upgraded to powershell 4.0 to fix a bug in powershell 3. When I did so, my script seems to have ...
0
votes
1answer
3k views

The term 'Get-ClusterResource' is not recognized as the name of a cmdlet, function, script file, or operable program

I have a powershell script that I'm attempting to execute over SSH. The command works perfectly when I run it from the server's powershell commandline. Here is my Powershell script: ...
1
vote
1answer
228 views

free disk monitoring windows 2012 - powershell

I have started from scratch to be able to learn how to monitor our server (only one). $dates=(get-date).ToString("s").Replace(":","-") $page="page"+$dates+".csv" get-wmiobject win32_pagefileusage | ...
1
vote
0answers
49 views

Manage UAG Server via WinRM

Does anyone know of there is a way to configure a UAG server to work with WinRM? We have a small number of servers and the "Server Manager" application as well as PowerShell are the way we generally ...
0
votes
1answer
686 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 ...
7
votes
2answers
2k views

What does 'Not Present' mean in the Get-NetAdapter Powershell Cmdlet?

Server 2012, Powershell 3.0. I'm doing some work that requires automating the enabling and disabling of network adapters. Here is an example of what I see when I run Get-NetAdapter: Name ...
2
votes
2answers
8k views

Powershell: Single Script to “clean” multiple folders of files older than

I would like to create a maintenance script that would run on each of our servers to clean out common drop/archive directories. Preferably the script would use a reference file for the folder path ...
10
votes
1answer
2k views

Set-RDSessionCollectionConfiguration Connection Broker connects to localhost

I am running the following command from a PowerShell console on a Windows 8 machine, trying to configure a Server 2012 R2 RDS Connection Broker: Import-Module RemoteDesktop Set-...
4
votes
1answer
608 views

What happens when User's UPN Suffix is not Trusted in Active Directory

I have 1275 UPN Suffix in the AD. This is the maximum allowed in Windows Server 2012. $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain(); $domaindn = ($domain....
0
votes
1answer
141 views

Hyper-V replica - PowerShell - replica merge (detect / invoke)

I need a PowerShell command which can detect replica merge process on the specific VM. And to be sure... There is no way how to invoke replica merge process using a PowerShell command.. Am I right? ...
2
votes
1answer
4k views

Possible to upgrade PowerShell 2.0 to 3.0 without a reboot?

Is it possible to upgrade powershell without reboot from 2.0 to 3.0 using Windows Server 2008?
1
vote
3answers
2k views

In PowerShell, how can I parse a preformatted output?

Is there existing tooling to take text-based output and pipe it to a dynamic object that can be queried as columns? Specifically, I'm invoking .. query session /server:MYSERVER .. which is ...
4
votes
2answers
167 views

Determine filterable attributes of returned Powershell object

Often when I'm scripting, I will be trying out a command but will want to filter the results. In order to find out what I'm able to filter on I need to know what filterable attributes are going to be ...
1
vote
1answer
671 views

PowerShell Remove-Item can't handle junctions

Windows Server 2012 using PowerShell to create a log file in the temp folder: $LogFile = $env:temp + "\MigrateMyDocs.log" Let's say one's script has already run and you want to delete the log file ...
0
votes
1answer
262 views

Trying to retrieve an error from addding a computer to AD using Powershell

I'm trying to figure out how to retrieve an error from adding a already there computer in Active Directory. Here's the script that I'm using to add my machine in my domain. Add-Computer -DomainName "...
4
votes
1answer
100 views

Powershell script to import CSV to AD

In attempts to automate a few things, I've come across a stumbling block with an import script for AD. A part of the script contains: New-ADUser -Name $Name –GivenName $Person.givenName –Surname $...
2
votes
0answers
1k views

Powershell 3.0 Enter-PSSession fails randomly, reboot solves it. DCOM error in Event Viewer on target machine

Using PowerShell's Enter-PSSession (even locally, against the local computer) fails randomly with the following message. Running Windows 2012 Standard with all updates. The error message takes a while ...
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 ...
1
vote
1answer
891 views

Creating a second domain in a forest using install-addsdomain

I have a domain ludwig.example.com and am trying to create a domain amadeus.example.com using install-addsdomain. I am running this command: install-addsdomain -newdomainname amadeus.example.com -...
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
753 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 ...
2
votes
1answer
441 views

Powershell Hyper-V Remote?

Im basically wondering if this is possible, Essentially I have a Powershell 3.0 Script that creates a Hyper-V Server/VHD etc.. it works well but it's obviously defaulting to my local machine. What Im ...
2
votes
3answers
2k views

Adding Unattended.xml Files to Hyper-V Powershell Creation?

As of right now I have a Powershell 3.0 Script Provisioning and Creating Servers. What I want to do is add an Unattended.xml to take it a step further (So I wouldn't have to get on and click next/...