Command search within Standard User

I’m trying to run the following command with a script powershell executionpolicy bypass -File .grantaccesscode.ps1. Unfortunately the command gives me errors as Powershell was run as an administrator and therefore the sub path to which the script is trying to access is only available as a standard user. How can I run the command as […]

Why do objects returned by invoke-command not contain all the same variables returned when the same command is executed locally?

For example: if I throw the certs in my cert store into a variable: $z=Get-ChildItem -Path CERT:LocalMachineMy I can then enumerate the friendlynames with a: $z.friendlyname But if I do the same remotely: $z=invoke-command -session $sess -scriptblock {Get-ChildItem -Path CERT:LocalMachineMy} I still get an array of objects with thumbprint, Subject, etc but no friendlyname. What’s […]

How to run a cmdlet multiple times with different values in parameters?

To start this question off, i’m making a test script which adds each VPN connection I have to my connection address book. This might be something extremely simple but so far what I’ve done just to run the cmdlet once is: $params = @{‘Name’ = ‘test-vpn’; ‘ServerAddress’ = ‘127.0.0.1’; ‘TunnelType’ = ‘L2TP’; ‘EncryptionLevel’ = ‘Optional’; […]

Retrieve additional attributes with Seach-ADAccount command

I am trying to retrieve additional attributes when using the following command: Search-ADAccount –PasswordNeverExpires | FT Name,ObjectClass -A With the command above, I am able to successfully retrieve the account Name and ObjectClass. However, when I want to retrieve additional attributes by using the following command: Search-ADAccount –PasswordNeverExpires | FT Name,diplayNme,description,ObjectClass -A The additional commands […]

Load a specific PSObject

This is difficult to explain, but I will try. I have dozens of psobjects I have written in a script. They have the same properties but with different values. eg: $partner1 = new-object psobject – property @{ firstname = ‘John’ lastname = ‘Doe’ email = ‘jdoe@globalhypermega.net’ folderid = ‘[insert long guid here]’ } I have […]