PowerShell Set-Acl recursively
Hi,I have the below script, works fine but when setting the ACL it only set's the ACL on the root folder and doesn't propagate down. How can I get it to set the ACL to all files and folders?1) imports...
View ArticleSet-HybridConfiguration showing error
Hello,About my Environment:Single Virtual Machine (VM) in Windows Azure with following ports enabled for public and private.HTTPSTCP 443LDAPTCP 389PowerShellTCP 5986Remote DesktopTCP 58142SMTPTCP...
View ArticleCount computers in each OU.
Can someone help me with the below. I wish to only count computers under an OU and recursively through that one. If possible I would also like it to stop reporting OU's with 0 computers (active or...
View ArticleAmend ALL user's SMTPs
Hello everyone, We're having a bit of trouble at the moment within our businessUsing the Exchange Management Shell, i want to write a script which takes all the SMTPs for a mailbox, and...
View ArticleRunning PowerShell versions 4 & 3 side by side (sxs)??
Hi,I have noticed that PS version 4 seems to "replace" version 3. I.e. there is no way to access 3 once 4 is installed. This differs to how version 2 & 3 operated, which allowed side by side...
View ArticleFormating XML content
I am trying to shred a XML document and formatting all the needed info. I have the following XML:<Drives><Drive> Status="Active"<properties>label="D...
View Articleforeach ending on a null?
Can someone explain what is going on in this foreach loop? If I remove the if ($Line) block, I get an error calling substring with 2 arguments, as if there is a "blank" line at the end of the array. I...
View ArticleFormatting output from psbase.InvokeGet
I can run the following script to get each user's name, FQDN's and RDS (Terminal Services) path. If I pipe the script to an OutFile when I run it, I get a text file with these elements listed on...
View ArticleEditing local Policies with PowerShell not possible?
Hello everyone,I would like to change a local Policy on a Server which is NOT in a domain. Is there a way to do this via PowerShell or any other way on Command line? Because I have a Core edition and...
View ArticleSharePoint Site Collection size using power shell with email body
Hi,I am getting all the list of site collection information with url and size as a attachment,but i want to get this information as body instead of attached document.Here is my code. $SiteCollurl =...
View ArticleCommand "Get-ChildItem IIS:\Sites" causes an error
Hi!Simple script shown below causes an exception on my computer:Import-Module WebAdministration Get-ChildItem IIS:\Sites---powershell -NonInteractive .\test.ps1 Get-ChildItem : Could not load file or...
View ArticleHow do I launch executable from PS prompt?
Hello,Very basic question, if I launch powershell and I'm trying to launch executable from "system32" (which is in PATH:), how do I do that without specifying exact path to it (like you can do in...
View ArticleHow can I sort PSObjects and remove duplicates with the oldest date?
Hi,I have a collection of PSObjects which contains several values. My goal is to produce a list of unique AppToken objects but the kicker is if a duplicate object exists, I need to keep the newest one...
View ArticleHelp pseudo code the logic of this function
I need to take a variable $year and find its destination. The destinations consist of 3 servers with 3 drives each. I was originally looking at a hash table, but then thought there has to be a way to...
View ArticleHow to pass an array of strings to a function in PowerShell?
I don't seem to be able to pass an array of strings as a parameter to a function in PowerShell. Here is my function definition: function TestConnectivity { Param( [string[]]$inputList,...
View ArticleAdd Service Account to windows group
Hello,I was wondering if it possible to add a service account to a windows group with Powershell? I would like to add a sql server service account to a windows group. Unfortunately, the OS I have...
View ArticleGet-ADuser to import fields to active directory powershell
HiI need to import some telephone fields to AD from csv file via PowerShell script, so first I export the specific fields to csv with this script:Get-ADUser -Filter * -Properties * | Select-Object -...
View Articlereferring config file in powershell
Hi,I am having a requirement like this..Having Power Shell Script like CPU utilization,number of user connected to IIS.I am getting the server names for both CPU and IIS like C:\CPU.txt and...
View ArticleAssistance with Powershell custom attribute population
I'm currently undertaking an exchange 2003 to exchange 2010 migration and as part of this am having to redesign the email address policies. Our legacy recipient policies have worked well by targeting...
View ArticleAdding groups while creating a bulk nt accounts
how do i add groups and DL's using a txt filewhen i am creatig new bulk accounts.Ex. abcm jkl,def are a seecurity group and def, efg, hij are distribition listThis is the script i use $users =...
View Article