Questions tagged [powershell-v3.0]

For issues relating to Windows PowerShell, version 3.0.

0
votes
0answers
51 views

What is a simple to allow me to download files from my Windows 2012 Server hosted on EC2?

I want to download files from my windows server hosted on EC2 from a command line client (i.e. without using RDP etc.). I don't want to set up file shares on the remote machine. My first thought was ...
0
votes
0answers
256 views

Checking the Status of AD users

I have been trying to get the Enabled Status of all users in our AD tree. I have tried several different things without much success. Here is what I've tried so far: Get-ADUser -Filter * | select ...
4
votes
2answers
2k views

Can I RDP through mstsc and run a script on that remote desktop?

I'm writing a powershell script which needs to RDP to a few servers and do processes there and then come back. mstsc /v:<computer> by itself looks great as it's security/credential prompt is ...
1
vote
1answer
97 views

Powershell Array for Path

We are trying to break the following Path from the text file, the path is dynamic in length, i.e, it can be ABC\DSD\AAR\ARE or ABC\DSD. So we need a solution to break down the path as per the ...
1
vote
0answers
517 views

Error in powershell: operation requires an interactive window station

I am executing below command through autosys(scheduling tool) to stop a service but it is failing with below error. The command works fine when i run the command on RUN(WIN+R) or cmd after RDPing into ...
0
votes
1answer
55 views

PS-Remote shell access to a user

I am currently adding Full control to an user manually. Please see below screen shot. But this needs to be done via a PS script.I followed https://blogs.technet.microsoft.com/heyscriptingguy/2010/11/...
-1
votes
2answers
274 views

Powershell script Needd to set the state of Allow Remote Shell Access [closed]

I am looking for a script which will set the value to "Enable/Not Configured/Disable" of Allow Remote Shell Access in Gpedit via Powershell script. Below value state value should get changed to ...
4
votes
1answer
319 views

How to defrag volume using mountpoint?

I am trying to defrag the volume by optimize-volume cmdlet . I have passed mount point path. But it fails as below. PS C:\Users\Administrator> Optimize-Volume -Path C:\Testvol1\disk Optimize-...
1
vote
1answer
3k views

Why is powershell slow on my machine?

There are several virtual machines in the group, and 2 of them have really bad performance running Powershell. A simple script like powershell.exe -NonInteractive -NoProfile -Command "Write-Output $...
0
votes
1answer
68 views

exchange management shell script to find changes on mailbox?

I have a question to you.I have a mailbox account in my exchange server 2016 which is used a smtp address for while.and now, because of changing its alias and smtp address, is there a way to find the ...
1
vote
2answers
2k views

Remote Powershell not working but test-wsman does

I need to script some routine task to execute remotly from a serverA to many hosts but a couple of them fail to execute the script. If i execute this: $cred = Get-Credential myUser Invoke-Command -...
1
vote
0answers
19 views

Exchange Custom Attributes Excemptions

I am trying to create a scenario by which a resource mailbox is hidden from all users unless specified. I have found the following article that i have used to hide the resource box; http://www....
0
votes
1answer
278 views

GWMI - Find out if Domain Controllers are physical or virtual via script

I have tried to create a script for extracting but the output is not quite I desired. $Servers = Get-ADDomainController -Filter * | Select-Object Name foreach($server in $servers) { $compsystem = ...
1
vote
0answers
77 views

Exchange Message Tracking Attatchments

I have a requirement by which i need to export a list of all emails with an attachment that have the following words within its subject (private,confidential) As it stands i can export all emails ...
2
votes
1answer
4k views

Howto check if a powershell command succeeded or not?

Is it possible to check if a powershell command succeeded or not? Example: Set-CASMailbox -Identity:blocks.5 -OWAMailboxPolicy "DoNotExists" caused the error: Outlook Web App mailbox policy "...
1
vote
1answer
2k views

Powershell Script to export directory folders and owners (excluding files)

I am trying to export all folders including child folders within a file share on a remote server alongside the owner info as shown (Note I do not need info re the files within the folders) get-...
0
votes
1answer
727 views

Failed to using powershell to get cookies

I am writing a powershell script to mimic a login process,and then catch data from web pages. I failed at the very begainning, I can't get into the login pages at all after I set up cookies. Here is ...
1
vote
1answer
495 views

Microsoft Azure Runbook not executing powershell script

I'm trying to run the powershell script below in Micrososft Azure runbooks. However, I keep on getting the error: The script is as follows: #### Provide the computer name in $computername variable $...
2
votes
2answers
9k 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
647 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
61 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
479 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....
10
votes
5answers
4k 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
129 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
61 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
284 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
299 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
1k 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, ...
1
vote
0answers
3k 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
30k 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
7k 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 ...
3
votes
1answer
8k 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
802 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 ...
2
votes
1answer
2k 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
246 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
41 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-...
4
votes
2answers
2k 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 - ...
5
votes
2answers
5k 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 ...
2
votes
2answers
6k 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
608 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
6k 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
1k 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 ...
8
votes
2answers
13k 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 "...
0
votes
1answer
509 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
7k 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
5k 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
272 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
66 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 ...
1
vote
1answer
2k 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
4k 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 ...