Quantcast
Channel: Windows PowerShell forum
Browsing all 21975 articles
Browse latest View live

trouble with nested foreach loop

I got 3 nested foreach loop but the 2nd and the third one outputs no data.$vss = "vSwitch3"$vmhost_array = @("host1,host2,host3")$vss_vlan_array = @("vlan50") $dvs_vlan_array = @("n1kv_vms_vlan50")...

View Article


Regarding this script....Powershell Scriptblock with Elevated Credentials

Powershell Scriptblock with Elevated Credentials is being tested under a GPO on my domain to force the logoff any user, who locks and walks away from a PC, by the next user who logs in using 'Switch...

View Article


Problems with Microsoft.Update.Session on Windows Server 2012R2

Hi, I've created a script for collecting Windows Update information using the "Microsoft.Update.Session" comObject.I got some problems collecting data from certain servers, but I don't understand what...

View Article

Cannot get HomeDirectory attribute

All the user accounts in OU have HomeDirectory and HomeDrive information in place when looking in ADUC-console.If I run command:Get-ADUser -SearchBase "OUxxxx"  -Filter * -properties * | select...

View Article

Creating Multiple Aliases for single Mailbox

I have the following code which works to a point. It gets as far as the Set-Mailbox and then throws an error which is:Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" to type...

View Article


Mapping Home Directory

Hello,I'm have a script that lets me create bulk user accounts  from a CSV but i'm not able to get the Home drive to map properly. The home drive is mapped but when i go to the check on the share drive...

View Article

Remotely renewing a certificate

I'm trying to renew a user's certificate using the CertEnroll COM objects from PowerShell. I am able to do it for certificates on my local machine but I am getting an error when I try to do it on a...

View Article

Problem Executing Move-VM (Hyper-V Cmdlet) Remotely

I am working on modifying a Shared Nothing Live Migration PS script which can be found here: http://blogs.inframon.com/post/2014/03/21/Scripting-Shared-Nothing-Live-Migration.aspx to allow this script...

View Article


Returning a warning an appropriate message to SCCM 2012 R2

Hi,Is it possible to return to SCCM an error message at the end of a script? I would like returning a warning or an error message to SCCM when a script end and the licence still need to be activate.I...

View Article


Variable expansion & surrounding expanded variables with quotes

Hi All,I'm trying to add a computer to a domain using the add-computer cmdlet, and I'm having a hell of a time figuring out what I'm doing wrong.  I know it has to do with the way my variables are...

View Article

Understanding scope of functions in powershell workflow

Copy and paste the following into a new Powershell ISE script and hit F5:workflow workflow1{"in workflow1" func1 } function func1 {"in func1" func2 } function func2 {"in func2" } workflow1 the error I...

View Article

Powershell Script to Update Central PolicyDefintions Store against the local...

Hi all,i've created a powershell script to update my central policydefinitions store against a local machine for example the newest domaincontroller or member server. It can be started with the...

View Article

Grouping and Extracting Data from Excel .

Hello I am a newbie to Powershell and I would be great full for some help!! I have a excel file with the following layout shown below.order no location   Refrence no...

View Article


Another powershell workflow script will run in powershell ISE but no...

Hi,Im having some issue with a few powershell workflow scripts that will work in powershell ISE but they will appear to not run in a Admin powershell command prompt session.The script is...

View Article

exchange mailbox creation: "Operation is not valid due to the current state...

My script uses the standard powershell window (from powergui). It is a copy user script that creates the AD user, create's their file share, adds them to group, sets expiration date etc. It has the...

View Article


change selection and refresh pivot table then save file

 I have an Xcel PivotTable that is connected to a Analysis Services Cube. I want to be able to Refresh that pivot table based upon yesterday date then re-save the xls file. This is done so is shows the...

View Article

User Security Access Script Needs Adjusting

Okay skipping straight to the point. I have a script that shows me what access a user has to a folder:$user = 'PC\TedTester' $folders = "C:\Test","C:\test2" $acls = Get-Acl -path $folders...

View Article


Truncate each line in a file to a specific number of characters

I've been tasked with writing a script that will massage data in a file that goes to a mainframe. The mainframe job is static and can't be modified. The file needs to be capped at 80 characters per...

View Article

Why wont this RUN and Set a New-Service..?

PS C:\WINDOWS\system32> New-Service -Name RunSafe -BinaryPathName C:\Users\3steveco33_01\Skydrive\Documents\Adminstartup.ps1 -DisplayName 'Active Protraction Service' -Description Safety and...

View Article

GPMC commandlets on Windows server core

Hi,   I need run a powershell script on Windows Server 2008R2 core. The script loads GroupPolicy module but GPMC can't installa on server core. Anybody knows other installation methode for GroupPolicy...

View Article
Browsing all 21975 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>