kittyz_game

Forum Replies Created

Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
    Posts
  • Avatar
    kittyz_game
    Member
    in reply to: Export printers, drive maps etc. to new machine #390358

    Re: Export printers, drive maps etc. to new machine

    I would start by looking at the User State Migration Tool from Microsoft. I do not recommend trying to script this process.

    Avatar
    kittyz_game
    Member
    in reply to: powershell script to isntall printers #390357

    Re: powershell script to isntall printers

    But I still don’t know what you mean when you say “it didn’t work for you”.

    Avatar
    kittyz_game
    Member
    in reply to: cacls works intermittently #390356

    Re: cacls works intermittently

    The first thing that comes to mind is something preventing the command from resolving the user name. Any error messages? Have you tried using icacls instead?

    Avatar
    kittyz_game
    Member
    in reply to: Get Quota Entry #390355

    Re: Get Quota Entry

    See if this helps get you started in the right direction: http://jdhitsolutions.com/blog/2009/11/get-disk-quota/

    Avatar
    kittyz_game
    Member
    in reply to: powershell script to isntall printers #390354

    Re: powershell script to isntall printers

    What do you mean PowerShell 3 “didn’t work for you?” Does this mean you have older clients that don’t support v3?

    Avatar
    kittyz_game
    Member
    in reply to: Help with restart VM in powershell #390353

    Re: Help with restart VM in powershell

    I think your time might be better served trying to solve the root problem. While you could create a PowerShell script there are a number of hurdles you have to clear. This would require access to the PowerCLI cmdlets which means they have to be installed on every client desktop, or you need to create a remoting setup where the clients run the command on a central server. I suppose the benefit with this approach is that the user can connect with alternate credentials. But packaging something securely with alternate credentials requires 3rd party software. And none of this is going to be easy if you have never seen PowerShell before.

    I’d say figure out the problem.

    Avatar
    kittyz_game
    Member
    in reply to: script that generates email – doesnt work #390352

    Re: script that generates email – doesnt work

    The network setting I was thinking of is the require network option you can set as a PowerShell scheduled job option. Have you tried creating a scheduled job to just send an email? That way you can test without having to do the backup. I still think it is a credential issue.

    In the task scheduler when you look at the job, make sure it is set to run whether a user is logged in or not and the do not store password checkbox is NOT checked. If it is that could be the problem.

    then you need to be sure that the account you are using the task is the same as the mail credential.

    What version of PowerShell are you testing with and on what operating system?

    Avatar
    kittyz_game
    Member
    in reply to: Printer managment #390351

    Re: Printer managment

    Is the 2008 R2 box running Server core or full GUI? There might be some .NET differences. That’s about the only other thing I can come up with.

    Avatar
    kittyz_game
    Member
    in reply to: script that generates email – doesnt work #390350

    Re: script that generates email – doesnt work

    When you created the schedule task, did you specify a credential and configure the task to access the network? Without a credential, the task can only do things local.

    Another possibility is that your SMTP server requires a credential and when you run the command interactively, it automatically uses your current credential.

    Avatar
    kittyz_game
    Member
    in reply to: powershell script to isntall printers #390349

    Re: powershell script to isntall printers

    How is this script being run? Is it running on the client computer somehow? The Add-Printer cmdlet requires PowerShell v3 or later which. Is the only issue the AD piece?

    Get-ADComputer is part of the ActiveDirectory module which I doubt you have installed on clients. You can fall back to use ADSI or the .NET AD classes like the DirectorySearcher.

    This is code that can run ON the client computer.

    $searcher=New-Object DirectoryServices.DirectorySearcher
    $searcher.Filter=”(&(objectcategory=computer)(name=$env:computername))”
    $me = $searcher.FindOne()

    $me.location

    Avatar
    kittyz_game
    Member
    in reply to: Printer managment #390348

    Re: Printer managment

    I don’t have the right network to test any of this.

    Avatar
    kittyz_game
    Member
    in reply to: Passing Credentials to a power shell script #390347

    Re: Passing Credentials to a power shell script

    And of course there is always the Get-Credential cmdlet.

    $cred = Get-Credential mycompanyadministrator

    You can then use $cred as the value for a -Credential parameter

    Avatar
    kittyz_game
    Member
    in reply to: Creating Windows printer ports #390346

    Re: Creating Windows printer ports

    I can’t find anyway to create anything else in Windows other than what you can create using Add-PrinterPort. If your printer uses a different port type, don’t know how you can access it. Have you tried contacting the printer vendor to see if they expose any of their print settings via COM or .NET?

    Avatar
    kittyz_game
    Member
    in reply to: Printer managment #390345

    Re: Printer managment

    If you have Windows 8 or later, see if Set-PrintConfiguration will do the trick.

    Avatar
    kittyz_game
    Member
    in reply to: Printer managment #390344

    Re: Printer managment

    I’m impressed. This is really digging deep. It might be as simple as this:

    $q2.DefaultPrintTicket.OutputColor=”Monochrome”

    Avatar
    kittyz_game
    Member
    in reply to: Set-ACL Error #390343

    Re: Set-ACL Error

    PowerShell takes any comma separated list and turns it into an array. So $users is an array of strings which is not what is expected when you create the access rule. You need to do something like this:

    [System.Security.Principal.NTAccount]$account=”BuiltinUsers”
    $rights = “CreateFiles”, “AppendData”, “ReadExtendedAttributes”, “ExecuteFile”, “ReadAttributes”, “ReadPermissions”
    $accessRule6 = New-Object System.Security.AccessControl.FileSystemAccessRule($account,$rights,”Allow”)

    Avatar
    kittyz_game
    Member
    in reply to: An Overview of the PowerShell ISE Object Model #390342

    Re: An Overview of the PowerShell ISE Object Model

    Thank you.:-P

    Avatar
    kittyz_game
    Member
    in reply to: Anyone using Box, Dropbox, or OneDrive? #390341

    Re: Anyone using Box, Dropbox, or OneDrive?

    I use DropBox, SugarSynch, Box and occasionally OneDrive. I use DropBox (free) because I work with a number of partners who rely on it. I have a paid subscription to SugarSynch which I like because I can pick which folders to synch so I don’t have to have everything under one location. Box comes in handy with Thunderbird when I have a large attachment. I have a Thunderbird extension that will upload to my account and insert a link into the email.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390340

    Re: Running an MSI remotely

    I don’t think the real problem here is PowerShell as much as the msi technology. But, yes i can see where it would be frustrating. In this case I think the issue is with the package installer. Unfortunately, not all installers are created equally nor are all viable under PowerShell, especially via a remoting session.

    I really don’t know if SCCM would work or if it is even an option in this situation.

    The most difficult aspect of this problem is that it is impossible to test anything because the install package is unique to that environment so the best I can do is lead someone down a path.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390339

    Re: Running an MSI remotely

    But think about how much you’ve learned!

    If it was me, I’d look at using a old-fashioned batch file as a computer startup or user logon script pushed by a GPO.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390338

    Re: Running an MSI remotely

    When you use PowerShell remoting, such as using Invoke-Command, PowerShell spins up a temporary environment called a runspace. Think of it as a non-interactive PowerShell console. The MSI you want to use has something in it that is incompatible. It’s not that PowerShell doesn’t work. It will happily kick off the MSI, but there is something in the package that can’t understand where it is running. Or if there is anything in the MSI that is trying to reference a network resource, that too will fail. That is the famed 2nd hop problem.

    I don’t think PowerShell is going to be an answer here, at least not with trying to repackage the MSI or coming up with an equivalent set of manual steps that you can run remotely.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390337

    Re: Running an MSI remotely

    Ok. From a a remote PowerShell session, calling the MSI from a network share will never work unless you enable CredSSP.

    When you run it in a remoting session and the MSI is local, there is no user profile loaded as you might expect in Windows so that will probably fail.

    But, if the MSI is local and the the MSI commands are in a script that you run interactively ON the machine, does it work or give you an error? If it works interactively it should work in a script. Don’t use Invoke-Command. Your script should be the same MSIExec command that you run manually. If you run into problems parsing the command, you can use Invoke-Expression.

    If *that* script works, you should be able to run it as a user logon script or maybe even start up script.

    Packaging apps is a real art that not everyone has mastered. And sometimes PowerShell isn’t the right answer. If you can get the process to work with an old-fashioned batch file, run with it.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390336

    Re: Running an MSI remotely

    When you run the commands interactively, is everything you are calling on the local hard drive? If you put all the commands in a script and run the script locally, does it work? If so, can you post the script? Feel free to change app names to things like foo.exe for foo.msi.

    What version of PowerShell?
    What is the client OS?

    I’m assuming the uninstall process requires admin privileges and an elevated session.

    Avatar
    kittyz_game
    Member
    in reply to: Running an MSI remotely #390335

    Re: Running an MSI remotely

    My first question would be if the original install was per machine or per user. You mentioned trying to setup a scheduled task through a start up script, which leads me to believe permissions might be an issue. I didn’t pick up if the uninstall logs give you any indication of why it is failing.

    To do anything in a remote session, the uninstall command must be local and not on a share. You can’t make a second hop in a PowerShell remoting session. I thought I saw a mention that you could connect to the network share with the MSI. That will work fine interactively, but not in a remote session.

    I would try putting the commands in a PowerShell script and see if they work in an interactive session. If so, create a GPO with a PowerShell startup script or logon script if that seems appropriate and try that. The script runs locally so it should be able to access remote shares, although remember the startup script runs under system.

    Avatar
    kittyz_game
    Member
    in reply to: Get AD DS data #390334

    Re: Get AD DS data

    This is pretty easy if you have the Active Directory module.

    Search-ADAccount -Computers -AccountInactive -Timespan 60.00:00:00

    hilsoe;285628 wrote:
    I am new to powershell and I need a script that can tell me which computer accounts have been active within the 2 last month.
Viewing 25 posts - 1 through 25 (of 25 total)