Jump to content


P@docIT

Established Members
  • Posts

    141
  • Joined

  • Last visited

  • Days Won

    3

P@docIT last won the day on September 6 2014

P@docIT had the most liked content!

Profile Information

  • Gender
    Male

P@docIT's Achievements

Newbie

Newbie (1/14)

5

Reputation

  1. Figured it out. I didn't realize there were two params for deadline enforcement. -EnforcementDeadline -EnforcementDeadlineDay Clearly the latter (which I was using) only supports the date (day). I switched to the first one and I am getting the correct times now but the date is being increased by 7 days from the current day for some reason. (ex. today is 8/4, despite my script saying the deadline date should be 8/7 it makes it 8/11) Anyway, thanks for looking. Maybe this will help someone else. EDIT: Here is what I ended up with. Sets the correct date and time # Set Deadline Date and Time $DeadlineDay = Get-Date -Month 08 -Day 08 -Year 2016 $DeadlineTime = Get-Date -Hour 16 -Minute 0 -Second 0 -EnforcementDeadlineDay $DeadlineDay -EnforcementDeadline $DeadlineTime.AddHours($Count) Cheers, Mike
  2. Hello All, I have a Powershell script that I use to create multiple Software Update Deployments and it works perfectly (well almost). The last piece I'm missing is automating the deadline date. Currently I just have it getting the current date and adding 5 days. I then go into each deployments properties and change the date/time to the desired info. I've been trying to work out automating this a little bit by adding a variable for a static date/time. I can then change this date (time will always be the same) to the desired info at script run. Below is what I've come up with so far. The -EnforcementDeadlineDay piece works on it own, in that it outputs the correct date with an incremented time. However once I put it in the full script i get the below errors. Any help is much appreciated. Cheers, Mike Script: # Monthly Deployment Date #$DeploymentDate = Get-Date -Format "yyyy-MM" $DeploymentDate = (Get-Date).AddDays(-30).ToString("yyyy-MM") $DeadlineDate = Get-Date -Month 08 -Day 07 -Year 2016 -Hour 17 -Minute 0 -Second 0 # Software Update Groups $SUPGroupName1 = "EN5 - EDC - Year 2013- ($DeploymentDate) Reference 1" $SUPGroupName2 = "EN5 - EDC - Year 2013+ ($DeploymentDate) Reference 2" #Load Configuration Manager PowerShell Module Import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1') #Get SiteCode and set Powershell Drive $SiteCode = Get-PSDrive -PSProvider CMSITE Set-location $SiteCode":" # Create Standard Deployments (Group 1) $DeploymentName = "EN5 - PM Dev ($DeploymentDate) Reboot Deployment # 1" $DeploymentCount = 6 $Count = 0 1..$DeploymentCount | ForEach-Object { $Count++ Write-Progress -Activity "Creating Deployment Group 1" -Id 1 -Status "Running $($Count) / $($DeploymentCount)" -PercentComplete (($Count / $DeploymentCount) * 100) Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" -CollectionName "EN5 - PM - Deployment $Count (Lab)" -DeploymentName "$DeploymentName-$Count" -DeploymentType Required -VerbosityLevel AllMessages -TimeBasedOn LocalTime -DeploymentAvailableDay (Get-Date) -EnforcementDeadlineDay $DeadlineDate.ToLongDateString()$DeadlineDate.Addhours($Count).ToLongTimeString() -UserNotification HideAll -SoftwareInstallation $True -AllowRestart $True -RestartServer $False -RestartWorkstation $False -ProtectedType RemoteDistributionPoint -UnprotectedType UnprotectedDistributionPoint -GenerateSuccessAlert $False -DisableOperationsManagerAlert $False -GenerateOperationsManagerAlert $False -PersistOnWriteFilterDevice $False -UseBranchCache $False } Write-Progress -Activity "Creating Deployment Group 1" -Id 1 -Completed Errors: Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '6:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '7:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '8:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '9:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '10:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand Start-CMSoftwareUpdateDeployment : A positional parameter cannot be found that accepts argument '11:00:00 PM'. At E:\scripts\EN5 - CreateDeployments - LAB.ps1:24 char:5 + Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "$SUPGroupName1" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( [Start-CMSoftwareUpdateDeployment], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeploymentCommand
  3. Ended up using VBS, works well. Option Explicit Dim objWMIService, objItem, colItems, strComputer, fso, WshShell, oExec On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select DriveType from Win32_LogicalDisk Where DeviceID = 'E:'") Set fso = WScript.CreateObject("Scripting.FileSystemObject") If Not fso.DriveExists("E:") Then Set WshShell = WScript.CreateObject("WScript.Shell") Set oExec = WshShell.Exec("setup.exe /s /v""/l*voicewarmup \""%temp%\besclientinstall.log\"" INSTALLDIR=\""C:\Program Files (x86)\BigFix Enterprise\BES Client\"" /qn""") x = oExec.StdOut.ReadLine 'Wscript.Echo x Else For Each objItem in colItems 'Wscript.Echo "Description: " & objItem.Description 'Wscript.Echo "DeviceID: " & objItem.DeviceID 'Wscript.Echo "DriveType: " & objItem.DriveType If objItem.DriveType = 3 Then Set WshShell = WScript.CreateObject("WScript.Shell") Set oExec = WshShell.Exec("setup.exe /s /v""/l*voicewarmup \""%temp%\besclientinstall.log\"" INSTALLDIR=\""E:\Program Files (x86)\BigFix Enterprise\BES Client\"" /qn""") x = oExec.StdOut.ReadLine 'Wscript.Echo x Else Set WshShell = WScript.CreateObject("WScript.Shell") Set oExec = WshShell.Exec("setup.exe /s /v""/l*voicewarmup \""%temp%\besclientinstall.log\"" INSTALLDIR=\""C:\Program Files (x86)\BigFix Enterprise\BES Client\"" /qn""") x = oExec.StdOut.ReadLine 'Wscript.Echo x End If Next End If
  4. Thanks Peter. Removing the trailing backslash from the from the log path got rid of the 1622 error, but now I'm getting a 1203 error. Which appears to be: ERROR_NO_NET_OR_BAD_PATH The network path was either typed incorrectly, does not exist, or the network provider is not currently available. Please try retyping the path or contact your network administrator. 1203 (0x4B3)
  5. Afternoon all, I am trying to setup a simple script that will determine if Drive E: exists and if so is it a CD Rom drive. Then based on that info run install command line. The if else logic seems to work but I'm having a hard time getting the install cmd to run. Any help would be greatly appreciated, I'm also open to other ways of doing this. Exit code btw is 1622. Cheers, Mike $instdir = Get-WmiObject -Class Win32_LogicalDisk | Where-Object {$_.DeviceID -eq "E:"} If (!($instdir)){ $process = start-process -filepath "setup.exe" -argumentlist '/s /v"/l*voicewarmup \"%temp%\besclientinstall.log\" INSTALLDIR=\"C:\Program Files (x86)\BigFix Enterprise\BES Client\" /qn"' -Wait -PassThru } ElseIf ($instdir.DriveType -eq "5"){ $process = start-process -filepath "setup.exe" -argumentlist '/s /v"/l*voicewarmup \"%temp%\besclientinstall.log\" INSTALLDIR=\"C:\Program Files (x86)\BigFix Enterprise\BES Client\" /qn"' -Wait -PassThru } Else { $process = start-process -filepath "setup.exe" -argumentlist '/s /v"/l*voicewarmup \"%temp%\besclientinstall.log\" INSTALLDIR=\"E:\Program Files (x86)\BigFix Enterprise\BES Client\" /qn"' -Wait -PassThru } $process.ExitCode
  6. Thanks. Made that change so that won't happen again. Hopefully last question. I need some MOF help. So I added the McAfee mof using Sherry K.'s steps in this post http://www.myitforum.com/forums/Mcafee-mof-beginner-issues-m242989.aspx. The issue is that is only looking for HKEY_LOCAL_MACHINE\\SOFTWARE\\Network Associates\\ePolicy Orchestrator\\Application Plugins I need to add HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Network Associates\\ePolicy Orchestrator\\Application Plugins Just now sure how to add, do i need to add a new section to the mof or can I just add a second ClassContext? EDIT: I added a second [dynamic, ... section to the "McAfee ePO Plugins Enumeration" section. Do i need to do anything after editing the config.mof to get that change to take effect? EDIT2: That seemed to do the trick. Report running perfectly. Thanks again. //-------------------------------------------- // Mcafee ePO Plugins Enumeration //-------------------------------------------- #pragma namespace ("\\\\.\\root\\cimv2") #pragma deleteclass("Win32Reg_Mcafee_ePO_Plugins", NOFAIL) [dynamic, provider("RegProv"), ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Network Associates\\ePolicy Orchestrator\\Application Plugins") ] class Win32Reg_Mcafee_ePO_Plugins { [PropertyContext("Software ID"), key] string SoftwareID; [PropertyContext("Version")] string Version; [PropertyContext("Product Name")] string ProductName; [PropertyContext("Plugin Path")] string PluginPath; [PropertyContext("Uninstall Command")] string UninstallCommand; [PropertyContext("Install Path")] string InstallPath; [PropertyContext("Installed Path")] string InstalledPath; [PropertyContext("HotFixVersions")] string HotFixVersions; [PropertyContext("HotFixInstallDate")] string HotFixInstallDate; [PropertyContext("DatInstallDate")] string DatInstallDate; [PropertyContext("DatVersion") ] string DatVersion; }; [dynamic, provider("RegProv"), ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Network Associates\\ePolicy Orchestrator\\Application Plugins") ] class Win32Reg_Mcafee_ePO_Plugins { [PropertyContext("Software ID"), key] string SoftwareID; [PropertyContext("Version")] string Version; [PropertyContext("Product Name")] string ProductName; [PropertyContext("Plugin Path")] string PluginPath; [PropertyContext("Uninstall Command")] string UninstallCommand; [PropertyContext("Install Path")] string InstallPath; [PropertyContext("Installed Path")] string InstalledPath; [PropertyContext("HotFixVersions")] string HotFixVersions; [PropertyContext("HotFixInstallDate")] string HotFixInstallDate; [PropertyContext("DatInstallDate")] string DatInstallDate; [PropertyContext("DatVersion") ] string DatVersion; }; #pragma namespace ("\\\\.\\root\\cimv2")
  7. Oh man the new query is much better as it picks up all machines. My previous query was only picking up machines that had VSE installed this shows the status of all machines and teh NULL fields show as n/a. Perfect. Thanks again for all of your help. I picked up a tremendous amount of knowledge in our two days together.
  8. Not a dumb question at all because I believe that was it. So now that i'm aware of the DB drop down I think my focus was on that drop down when I attempted to scroll in another window, inadvertantly changing the DB.
  9. Not sure you can see in the screenshot that dbo.v_R_System_Valid shows up in the oblect explorer. So not sure, server might need a reboot.
  10. The multi-part identifier "RV.Netbios_Name0" could not be found. Along with all of the other items underlined in red in the screenshot. output error: Msg 208, Level 16, State 1, Line 1 Invalid object name 'dbo.v_R_System_Valid'. Hmm interesting. I plugged the sql that I worked on yesterday into sql and executed and I'm getting the same errors about dbo.v_R_System_Valid being an invalid object. I didn't change anything. Don't understand why it worked yesterday but not today. I'm using that same sql in report builder and execting the report seems ot be working.
  11. I get a bunch of errors with that code.
  12. So close... thought i found a solution for the null fields but it doesn't work, the query doesn't fail but it doesn't change the value. ISNULL(NULLIF(EPO.Version0,''),'Not Installed') AS 'Host Intrusion Prevention' SELECT a.[Computer Name],a.[McAfee VirusScan Enterprise],a.[McAfee Agent],b.[Host Intrusion Prevention],c.[EnCase Enterprise Agent] FROM (SELECT RV.Netbios_Name0 AS 'Computer Name', RV.ResourceID AS 'Resource', ARP.Version0 AS 'McAfee VirusScan Enterprise', EPO.Version0 AS 'McAfee Agent' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_Add_Remove_Programs ARP ON RV.ResourceID = ARP.ResourceID INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE ARP.DisplayName0 like '%VirusScan%' AND EPO.SoftwareID0 = 'EPOAGENT3000') a LEFT OUTER JOIN (SELECT RV.Netbios_Name0 AS 'Computer Name', ISNULL(NULLIF(EPO.Version0,''),'Not Installed') AS 'Host Intrusion Prevention' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE EPO.ProductName0 = 'Host Intrusion Prevention') b ON a.[Computer Name] = b.[Computer Name] LEFT OUTER JOIN (SELECT vSMS_G_System_SoftwareFile.ClientId AS 'Resource', vSMS_G_System_SoftwareFile.FileVersion AS 'EnCase Enterprise Agent' FROM dbo.v_R_System_Valid RV INNER JOIN vSMS_G_System_SoftwareFile ON RV.ResourceID = vSMS_G_System_SoftwareFile.ClientId WHERE FileName = 'RDNS.exe') c ON a.Resource = c.Resource ORDER BY [Computer Name]
  13. I think I got it. SELECT * FROM (SELECT RV.Netbios_Name0 AS 'Computer Name', ARP.Version0 AS 'McAfee VirusScan Enterprise', EPO.Version0 AS 'McAfee Agent' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_Add_Remove_Programs ARP ON RV.ResourceID = ARP.ResourceID INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE ARP.DisplayName0 like '%VirusScan%' AND EPO.SoftwareID0 = 'EPOAGENT3000') a LEFT OUTER JOIN (SELECT RV.Netbios_Name0 AS 'Computer Name', EPO.Version0 AS 'Host Intrusion Prevention' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE EPO.ProductName0 = 'Host Intrusion Prevention') b ON a.[Computer Name] = b.[Computer Name] Now on to the isNull. EDIT: Dang I just noticed that this shows a second computer name column. Man I have stop posting before looking at the problem.. SELECT a.[Computer Name],a.[McAfee VirusScan Enterprise],a.[McAfee Agent],b.[Host Intrusion Prevention] FROM (SELECT RV.Netbios_Name0 AS 'Computer Name', ARP.Version0 AS 'McAfee VirusScan Enterprise', EPO.Version0 AS 'McAfee Agent' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_Add_Remove_Programs ARP ON RV.ResourceID = ARP.ResourceID INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE ARP.DisplayName0 like '%VirusScan%' AND EPO.SoftwareID0 = 'EPOAGENT3000') a LEFT OUTER JOIN (SELECT RV.Netbios_Name0 AS 'Computer Name', EPO.Version0 AS 'Host Intrusion Prevention' FROM dbo.v_R_System_Valid RV INNER JOIN dbo.v_GS_McAfeeEPO0 EPO ON RV.ResourceID = EPO.ResourceID WHERE EPO.ProductName0 = 'Host Intrusion Prevention') b ON a.[Computer Name] = b.[Computer Name]
  14. Disregard... switched to your syntax, also noticed I had a typo in mine.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.