Run Time Error "424' Object Required Error
Sub Button1_Click() Dim WshShell As Object Set WshShell = CreateObject(“WScript.Shell”) WshShell.LogEvent Set WshShell = Nothing End Sub I get error at set wshShell = CreateObject("WScript.Shell") (Run...
View ArticleUser ACL on SubFolders and combining 2 functions
Hello Guys and Gals,I am trying to figure out this script, where when a user specifies a path. The script will go there list all of the child items, show the users, groups, and permissions for those...
View ArticleCalling functions from a imported module and Regex
HiI am sure this is going to be a very easy question for most Powershell scripters.... My goal is to validate the value of a variable in an array to ensure it only has the accepted characters, a-z and...
View Articlecheck exists
function get-checkdrive($server) { write-verbose "check drive -started" $check= 'D:\' # no escape $testobj=get-wmiobject win32_volume -filter "DriveLetter= 'D:'" -computername $server $caption=...
View ArticleInvoke-Command not returning correct information...?
Hi,I'm trying to get the responding state of the java process on a remote server. When i run the command below locally on the server I get the state "false":Get-Process java | select -Expand Responding...
View ArticleNew line for each text in variable
I have a variable $computers which outputs like :write-host $computers ComputerA ComputerB ComputerC How can I output the variable with each text on a new line, i..e ?write-host $computers...
View Articletest-connection returns invalid query error
In many of my scripts that loop through an array of computer names, I use "test-connection" first to make sure the computer is alive before moving on with the script. Sometimes, for a period of...
View ArticleRemove all duplicates in CSV file
Hi, i have a csv file which i want to remove all duplicates from 1 column.For example $csvuser id---- -------user1 1user2 2user2 3user3 4I want to remove...
View ArticleHow to propagate CmdletBinding parameters through Invoke-Command?
I have a set of scripts with the CmdletBinding attribute applied that run scripts on other servers.For example, I have a Stop-MyServices that stops my services on all my servers:function...
View ArticleGet user mailbox script
Hello, can someone please tell me why this particular one doesn't return any values for the mailbox size? It works if I add the mailbox size property to the objects later, but I would think this...
View ArticleGet-ADReplicationSubnet problem with custom object
Hi, I'm writing a script which builds a AD Domain Structure. In order to build a Site/Subnet structure, I import a list of Subnets from a csv file and, before creating the subnet, I checked if it does...
View ArticleImporting a CSV to fill-in some AD fields
Hi,we have a large CSV with some additional information for some users. Additional phonenumbers, www-pages etc. A sample line from the CSV is this:...
View ArticleReading data from excel file getting strange strings.
$xl = New-Object -COM "Excel.Application" $xl.Visible = $true $wb = $xl.Workbooks.Open("C:\report030113.xlsx") $ws = $wb.Sheets.Item(1) for ($i = 3; $i -le 150) { if ($ws.Cells.Item($i, 1).Value2 -ne...
View ArticleHow to zip files and folders using powershell?
I want to zip Folder2 and Folder4 (specific folders) with subfolders and files using powershell. Any help is appreciated.Folder1 Folder2 Folder7 Folder8 Folder3 Folder4...
View ArticleNeed help... forgot how to do it!
Hi,I'm trying to remember how to do this:$users = Get-ADUser -Filter *Now I want to show only the "Name" column (and not using $users | select Name)$users.nameThat command wasn't supposed to do...
View ArticleHow to create a txt file with specific info
Hi,I'm back...I'm trying to create one pure text file with this info:<samaccountname> <name> \nWhat I'm doing to get to it:Import-Module ActiveDirectory$users = Get-ADUser -Filter *$users |...
View Articlebatch/scripts file fro deleting files older than X days
Hi, can any one provide me with bath/script file for deleting files under a directory and its subdirectory without actually deleting directories.Files which are older than say 7 days.i need this...
View ArticlePoowershell execute a job in the background
I am trying to execute a powershell command in my local computer using the below command. I log in to powershell and then execute the below command to execute a cmd script in the background , in my...
View Articleerror using Get-TSServers (part of PSTerminalServices module)
I am using the custom module, PSTerminalServices found here (http://archive.msdn.microsoft.com/PSTerminalServices) but when I try to use the cmdlet Get-TSServers, whether I specify a domain name or...
View ArticleCan I change the Pagefile Location via Powershell?
I've been asked to write a small script that can get run on new machines. One of the things they want to do is change the pagefile location form C: to E:. Is that something that can be done in...
View Article